• Resolved bruffridge

    (@bruffridge)


    I’m trying to format the attachment date, but the two formatting options I’ve tried aren’t working. What am I missing?

    My Syntax:
    [+date,date(‘F j, Y’)+]

    Tried ,timestamp and ,date.

    ,timestamp(f) Many date and time values such as [+meta:image_meta.created_timestamp+] are stored as a UNIX timestamp. The “,timestamp” format converts a timestamp into a variety of date and/or time string formats, using the PHP date() function. Details on the format_string argument can be found at: http://php.net/manual/en/function.date.php.

    The default format string is “d/m/Y H:i:s”, e.g., “31/12/2014 23:59:00” (just before midnight on new year’s eve). You could code [+meta:image_meta.created_timestamp,timestamp(‘j F, Y’)+] to display “31 December, 2014”.
    ,date(f) Many EXIF date and time values such as DateTimeOriginal and DateTimeDigitized are stored as strings with a format of “YYYY:MM:DD HH:MM:SS”. You can parse this format and just about any English textual datetime description into a Unix timestamp, then format the result by using the “,date” format. This format first uses the PHP strtotime() function, then the date() function. The “Supported Date and Time Formats” can be found at: http://php.net/manual/en/datetime.formats.php.

    The default format string is “d/m/Y H:i:s”, e.g., “31/12/2014 23:59:00” (just before midnight on new year’s eve). You could code [+exif:DateTimeOriginal,date(‘j F, Y’)+] to display “31 December, 2014”.

    https://ww.wp.xz.cn/plugins/media-library-assistant/

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author David Lingren

    (@dglingren)

    Thanks for your question and for all the details you provided.

    There is a small defect in the current official (v2.14) MLA version that gets confused when a comma is part of the format string. I believe the defect is corrected in the current Development Version. You can find step-by-step instructions for using the Development Version in this earlier topic:

    MLA errors when using plugin

    If you get a chance to try the Development Version please let me know how it works for you. I will leave this topic unresolved until the fix goes out in the next official MLA version.

    Of course, you can try removing the comma from your format string to confirm that this is the only problem.

    I regret the inconvenience the defect has caused. Thanks for your interest in the plugin.

    Plugin Author David Lingren

    (@dglingren)

    I have released MLA version 2.15, which contains a fix for the “comma in format string” defect you discovered.

    I am marking this topic resolved, but please update it if you have any problems with the new version. Thanks again for reporting the problem.

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘date format’ is closed to new replies.