phpretard Posted May 20, 2008 Share Posted May 20, 2008 The Code Below Printed this: Monday, May 19, 2008 1211258618 I think >>>1211258618<<< that is supposed to be the time. So what is the time or how the heck do you translate that into human time? $t=time(); echo($t . "<br />"); echo(date("D F d Y",$t)); Quote Link to comment Share on other sites More sharing options...
kenrbnsn Posted May 20, 2008 Share Posted May 20, 2008 That code, as it's written, could not product that output. <?php $t=time(); echo($t . "<br />"); echo(date("D F d Y",$t)); ?> would produce something like 1211259067 Tue May 20 2008 The first number "1211259067" is the UNIX timestamp of "right now". The string is that time stamp turned into something readable. Ken Quote Link to comment Share on other sites More sharing options...
sanderphp Posted May 20, 2008 Share Posted May 20, 2008 use echo date(DATE_RFC822); ; I believe that big number is seconds since some date in 1970. Quote Link to comment Share on other sites More sharing options...
Ne.OnZ Posted May 20, 2008 Share Posted May 20, 2008 Time has it's own letters and such... a= Lowercase Ante meridiem and Post meridiem(am or pm) A= Uppercase Ante meridiem and Post meridiem(AM or PM) g= 12-hour format of an hour without leading zeros(1 through 12) G= 24-hour format of an hour without leading zeros(0 through 23) h= 12-hour format of an hour with leading zeros(01 through 12) H= 24-hour format of an hour with leading zeros(00 through 23) i= Minutes with leading zeros(00 to 59) s= Seconds, with leading zeros(00 through 59) u= Milliseconds (added in PHP 5.2.2) Example: 54321 To write this: date('h:i:s A') = 03:12:46 PM You get the idea. Hope this helped! Quote Link to comment Share on other sites More sharing options...
phpretard Posted May 20, 2008 Author Share Posted May 20, 2008 http://www.w3schools.com/php/func_date_time.asp <-- is where I got it from It certainly puts out "Monday, May 19, 2008 1211258618" exactly. Let me rephrase the question... I want to echo The date and time. What is the best way to do such? Quote Link to comment Share on other sites More sharing options...
phpretard Posted May 20, 2008 Author Share Posted May 20, 2008 Oh... I get it Ken - the number is some weird form of the date. Quote Link to comment Share on other sites More sharing options...
Ne.OnZ Posted May 20, 2008 Share Posted May 20, 2008 I think you should read this page: http://us.php.net/date On that page it shows some examples a little down the page. To print the date and time, you could do something like this: echo date('l jS \of F Y h:i:s A'); = Monday 8th of August 2005 03:12:46 PM ^From the link above. You can move around the letters to have it appear as you want. Quote Link to comment Share on other sites More sharing options...
The Little Guy Posted May 20, 2008 Share Posted May 20, 2008 <?php $t=time(); echo($t . "<br />"); echo(date("D F d, Y g:i:s",$t)); ?> 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.