Jump to content

What Time Is It?


phpretard

Recommended Posts

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));

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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!

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.