WordPress.org

Support

Support » Plugins and Hacks » Returning date prior to 1970

Returning date prior to 1970

  • Firstly, THANK YOU for this amazing plugin. You have saved me literally hours of time.

    However, I’m having trouble returning dates before 1970 using the helper functions:

    $startdateymd = date('Y-m-d', get_scpt_formatted_meta( 'event-start-date' ));

    This returns the date of 1549/07/09 as 1970/01/01. Is this because of the way the timestamp is being generated by get_scpt_formatted_meta? Is there a workaround?

    I also have a select which is returning the ID instead of the value:

    $startdatetype = get_scpt_formatted_meta( 'event-start-date-type' );

    Is there a way of returning the value instead of the ID?

    Thanks again.

    http://wordpress.org/plugins/super-cpt/

Viewing 1 replies (of 1 total)
  • I’ve actually managed to find a solution to the first part of my question by creating new DateTime object and get_post_meta instead of get_scpt_formatted_meta. Posting in case it is of use to anyone else:

    $startdate = new DateTime(get_post_meta($post->ID, 'event-start-date', TRUE));
    echo $startdate->format('Y-m-d');

    Still looking for a solution for returning the value of the select instead of the ID.

Viewing 1 replies (of 1 total)
  • The topic ‘Returning date prior to 1970’ is closed to new replies.