WordPress.org

Support

Support » Plugins and Hacks » Advanced Custom Fields » [Plugin: Advanced Custom Fields] Datepicker Timestamps Incorrect

[Plugin: Advanced Custom Fields] Datepicker Timestamps Incorrect

Viewing 4 replies - 1 through 4 (of 4 total)
  • +1. Looking for help on this issue. ACF site is down right now, otherwise maybe I’d find some help there.

    Figured it out. The above value is stored in milliseconds (I think) by the javascript date picker whereas PHP prefers seconds. So all you need to do is divide by 1000! (Thank goodness for stackoverflow.)

    Here’s my code that worked:

    <?php echo date( 'F jS, Y', get_field( 'publish_date' ) / 1000 ); ?>

    This really should get worked into the ACF documentation, but hopefully others will find this answer here.

    Thanks for this… helped me out. Although for some reason my output date was off by 1 day so i added ‘+ 86400’ in the calculation, which corrected it, thanks to a comment in the stackoverflow link by mrwweb.

    @ruhelamin, glad that helped!

    With your off by one-day issue, try outputting the original value as a date and time to make sure that it’s actually off by a full day (i.e. exactly 24 hours) and not some in-between amount. If it’s anything other than 24 hours off, it’s probably a time zone issue that you may want to resolve. Otherwise, adding that value may sometimes make the date wrong.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘[Plugin: Advanced Custom Fields] Datepicker Timestamps Incorrect’ is closed to new replies.
Skip to toolbar