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. Quote 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(). Quote 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 Quote 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 Quote 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
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.