0
PHP Timestamp conversion to date returning a date with 1970 as the year
Am capturing login time to be used in setting the base time to be applied in ending the session if the time exceeds five minutes... i have captured the login time from login page as <?php ..... $_SESSION["start"]=time(); ?> and then i have called that stored variable from the session and used it on my Orders.php page which is returning a false date of 1970... <?php .... $p=$_SESSION["start"]; $c=$p/1000; date_default_timezone_set("Africa/Nairobi"); echo date('D M d Y H:i:s', $c); ?> The date is returning a false time stamp please help
7 odpowiedzi
+ 1
you dont need to divide the time with 1000
+ 1
because date() need milisecond but the the code you supply it with second.
0
Even if the time is in milliseconds which i assume is the default format for timestamps
0
yep. date() function require milisecond.
0
Yeah so the code is okay but the compiler is returning 1970
0
So i should supply the date function a timestamp which is in milliseconds?
0
It worked bro your really good at this man