• Resolved Mattki

    (@mattki)


    I am using in a template the variable $image->meta_data[“created_timestamp”] to get the time when the picture had been taken. However this give me only the date, hour and minutes but not the seconds.
    It tried to format it with the php function date() but obviously it is not a real timestamp but a string.
    Has anybody an idea how to get also the seconds?

    -Mattki

    https://www.ads-software.com/plugins/nextgen-gallery/

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Contributor photocrati

    (@photocrati)

    @mattki – I would recommend using date_i18n() as I find it works better within WordPress for timestamps but you will likely need to review your parameters being used (which are very similar to the date() function) to ensure you are displaying the “seconds”.

    – Cais.

    Thread Starter Mattki

    (@mattki)

    Cais,

    Thanks for your answer.
    The problem is not the format but the value $image->meta_data[“created_timestamp”] which is not a Unix timestamp but a string showing date and time in a given format.
    Do you have an idea how to get the picture taken time out of the exif data as Unix timestamp?
    Thanks!

    – Mattki

    Thread Starter Mattki

    (@mattki)

    I forgot to say that I am using a German version. And the template imagebrowser-exif.php is also not showing the seconds, see screenshot

    – Mattki

    Benjamin

    (@benjaminowens)

    You can convert a string date to Unix timestamps with strtotime()

    Thread Starter Mattki

    (@mattki)

    Benjamin,

    Thanks for the tip!

    Actually I solved it with

    <?php
    $timestamp = strtotime($image->imagedate) ;
    echo strftime('%x  %X', $timestamp) ;
    ?>

    – Mattki

    Plugin Contributor photocrati

    (@photocrati)

    @mattki – Thanks for the update! Well done!

    – Cais.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Exif: need also seconds of the created time’ is closed to new replies.