Jump to content

date echoes out as 1969-12-31


chemicaluser

Recommended Posts

Some of the dates (timestamp) in my database have a value of

0000-00-00 00:00:00

 

when I echo out the date - I see

1969-12-31 19:00

 

echo 'Date Added - ' . date("Y-m-d G:i ", strtotime($row['time_added'])).'<br/>';

 

anyone know why ...is it because 0000-00-00 is not a valid date?

any way to make it display the words "n/a" instead of the 1969-12-31

Link to comment
https://forums.phpfreaks.com/topic/250125-date-echoes-out-as-1969-12-31/
Share on other sites

thanks, that did it ... but i have one more qustion

 

if ($time_added == 0) echo 'Date Added - n/a <br/>';    
if ($time_added != 0) echo 'Date Added - ' . date("Y-m-d G:i ", strtotime($row['time_added'])).'<br/>';

 

the second part does not work, if the time not equal to 0 - any ideas?

 

 

 

 

and in my reading around i did find that

Western Hemisphere = 31 Dec 1969

Eastern Hemisphere =  1 Jan 1970

 

:)

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.