Home › Forums › Bug Reports › Date Picker – date appears as 1st Jan 1970??? › Reply To: Date Picker – date appears as 1st Jan 1970???
I am having the same problem as well.
I’m using the following code in my theme functions file
function datepicker_to_unix( $date ){
$dateparts = explode('/', $date);
$unixtimestamp = strtotime(date('d.m.Y', strtotime($dateparts[1].'/'.$dateparts[2].'/'.$dateparts[0])));
return $unixtimestamp;
}
And then the following in my template file
<?php $date = get_field('field_name'); echo date('F d, Y', datepicker_to_unix($date )); ?>
The result outputs: January 01, 1970
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.