user1028428
user1028428

Reputation: 81

Change the simple date time format to show time zone

I have a simple date time in the format 10/20 4:30PM. I want it to display in the format 10/24 1:30PM -007. I am saying date('Y-m-d H:i:sT', $time_recieved) assuming T is for timezone. But It is still not giving the time zone. What might be the reason? Is there any other format I am missing?

Upvotes: 0

Views: 5807

Answers (2)

themazz
themazz

Reputation: 1147

You can have a look at the official manual of PHP : date ();

http://www.php.net/manual/en/function.date.php

I tested that and I used on my server with :

$time = time(); 
echo date('Y-m-d H:i:s T', $time); 

it shows the timezone perfectly. Check $time_received, it might be an erroneous number, try with local time with time´() function to ensure that it's OK.

Good luck

Upvotes: 5

Landjea
Landjea

Reputation: 384

What you want is O not T I believe.

Check the PHP date page for all the format listings possible.

http://php.net/manual/en/function.date.php

Upvotes: 5

Related Questions