Date Display Empty With $record->get_value()
-
I’m using the templating for a custom display. I’ve instantiated PDb_Template() and using get_value() to retrieve the value of a date field.
$record = new PDb_Template( $this );
$date_field = $record->get_value(‘start_date’);I’m putting the date field through the date() function and treating the second parameter as a string, converting it to time() via strtotime(). However, I’m getting a null value and the date display only shows today’s date. I’m thinking that maybe I don’t need the strtotime() function in date, since maybe the data is stored as time() format but I haven’t been able to find any documentation that explicitly states this. If I want to use date(), could I just input the value of $date_field or do I still need to use with strtotime()?
$date_display = date( ‘YYYY-MM-DD’, strtotime($date_field) );
The topic ‘Date Display Empty With $record->get_value()’ is closed to new replies.