Jump to content

echo "time=" . time(); But Format to: Tue Mar 1 23:50:00 GMT-0300 2011 EXAMPLE


Recommended Posts

Hey Guys!

I have the following doubt.

 

When echoing from Server like this:

 

echo "time=" . time();

 

I get the time in the following raw format: 1299272294

 

I would really like to echo it with this format: Tue Mar 1 23:50:00 GMT-0300 2011

 

Is there a way I could do that?

 

Really looking forward for some help on this one,

 

Thanks a lot in advance!

Cheers!

First of all, Thanks a lot guys for the help!

 

Jcbones, that line of code is 95% correct to what I need, theres only one slight change, I am echoing the following:

 

Fri Mar 4 18:10:25 e-0300 2011

 

and it should be:

 

Fri Mar 4 18:10:25 GMT-0300 2011

 

Any ideas and/or suggestions?

 

Thanks again!

Cheers!

What version of PHP are you using?

 

e Timezone identifier (added in PHP 5.1.0) Examples: UTC, GMT, Atlantic/Azores

 

You could just write the GMT in there, it would have to be escaped though.

echo 'time=' . date('D M j H:i:s \G\M\TO Y');

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.