Ninjakreborn Posted April 19, 2006 Share Posted April 19, 2006 <?php print time(); $foo = time(); print $foo;?> umm why did this give me 11454150731145415073 that updates every time I hit refresh, is there a better way to do this, htis may be the time, but I don't understand this language of time, I am use to 10:30, 12:20 or so so, military time, gmt +- theories, What is this number here for that autoupdated everytime I hit the refresh button. Link to comment https://forums.phpfreaks.com/topic/7809-code-help/ Share on other sites More sharing options...
redarrow Posted April 19, 2006 Share Posted April 19, 2006 [code]$mytime=time(hms);echo $mytime;[/code] Link to comment https://forums.phpfreaks.com/topic/7809-code-help/#findComment-28449 Share on other sites More sharing options...
Ninjakreborn Posted April 19, 2006 Author Share Posted April 19, 2006 Then I get the output of1145415854 this is confusing. In javascript you just throw down a few variables ina function, and you can get the time, is it better doing this with javascript. Or is it really complicated with php. Link to comment https://forums.phpfreaks.com/topic/7809-code-help/#findComment-28451 Share on other sites More sharing options...
neylitalo Posted April 19, 2006 Share Posted April 19, 2006 That's the current Unix timestamp. You want to use the date() function to format the date like this:[code]<?php$timestamp = time();$formatted = date("g:h:i", $timestamp);echo $formatted;?>[/code] Link to comment https://forums.phpfreaks.com/topic/7809-code-help/#findComment-28452 Share on other sites More sharing options...
Ninjakreborn Posted April 19, 2006 Author Share Posted April 19, 2006 thank you. Link to comment https://forums.phpfreaks.com/topic/7809-code-help/#findComment-28453 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.