Date () or format_date () returning 1970?

I have a table with a date field that is correctly populated.
When I do the following <?php print $mytable->date; ?> <?php print $mytable->date; ?> works fine; however, when I format it using date() or format_date() , it just returns 01/01/1970.

It is stored in an array before being placed in an HTML table, if that matters.

+4
source share
1 answer

You can use the following (if the format $mytable->date matches strtotime ()) and accepts the first parameter for your needs:

 <?php echo date('Ymd H:i:s', strtotime( $mytable->date )); ?> 
+9
source

All Articles