avillanu Posted August 4, 2007 Share Posted August 4, 2007 Very simple script: <?php $time = time(); echo $time; echo date("d M Y H:i:s", strtotime($time)); ?> It's giving output 118626595531 Dec 1969 17:59:59 So time() is working but when I try to convert it to some "normal" way of displaying things I get the default. Link to comment https://forums.phpfreaks.com/topic/63355-solved-date-always-giving-dec-1969-175959/ Share on other sites More sharing options...
Daniel0 Posted August 4, 2007 Share Posted August 4, 2007 Remove the strtotime(). Link to comment https://forums.phpfreaks.com/topic/63355-solved-date-always-giving-dec-1969-175959/#findComment-315739 Share on other sites More sharing options...
BlueSkyIS Posted August 4, 2007 Share Posted August 4, 2007 ^^ Haha. I type too slow....or too much. date() takes a timestamp. you are getting the timestamp time(), but then you are trying to convert the timestamp to a timestamp again by using strtotime(). Remove strtotime(): echo date("d M Y H:i:s", $time); -BSIS Link to comment https://forums.phpfreaks.com/topic/63355-solved-date-always-giving-dec-1969-175959/#findComment-315741 Share on other sites More sharing options...
avillanu Posted August 4, 2007 Author Share Posted August 4, 2007 awesome thanks Link to comment https://forums.phpfreaks.com/topic/63355-solved-date-always-giving-dec-1969-175959/#findComment-315746 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.