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. Quote Link to comment Share on other sites More sharing options...
redarrow Posted April 19, 2006 Share Posted April 19, 2006 [code]$mytime=time(hms);echo $mytime;[/code] Quote Link to comment 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. Quote Link to comment 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] Quote Link to comment Share on other sites More sharing options...
Ninjakreborn Posted April 19, 2006 Author Share Posted April 19, 2006 thank you. Quote Link to comment 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.