WordPress.org

Forums

SuperCPT
Returning date prior to 1970 (2 posts)

  1. ubiqq
    Member
    Posted 1 year ago #

    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/

  2. ubiqq
    Member
    Posted 1 year ago #

    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.

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • SuperCPT
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic