codebyte
12-15-2010, 09:13 AM
Hi,
I just would like to know how to produce the current time like
8:30 pm
I was having trouble using the date function like this
date("F j, Y, g :i a ")
for it produces a time under a different (default) timezone.
any help please...thanks
abduraooft
12-15-2010, 10:33 AM
for it produces a time under a different (default) timezone.
Set your servers default timezone (http://php.net/manual/en/function.date-default-timezone-set.php) first.
Rowsdower!
12-15-2010, 07:13 PM
You can do as abduraooft suggests or you can simply do math on the time() function's timestamp result to add/subtract the appropriate amount of time before running the date() function on that timestamp - which you might need/want to do for adjustments from GMT (for example).
tripflex
12-16-2010, 05:49 PM
Hi,
I just would like to know how to produce the current time like
8:30 pm
I was having trouble using the date function like this
date("F j, Y, g :i a ")
for it produces a time under a different (default) timezone.
any help please...thanks
All you need to do is set the timezone, use the reference that abduraooft gave you.
If you need to find out what your current time zone is use:
http://www.php.net/manual/en/function.date-default-timezone-get.php
And here's the list of supported timezones:
http://www.php.net/manual/en/timezones.php
That should fix your issue easily
codebyte
12-19-2010, 06:28 AM
:):):):)Hi
I actually got the answer before I returned back to this post and saw the replies..
I read the php manual for time manipulations and just adjusted the timezone
date_default_timezone_set() to fit the timezone I am in..
Thanks anyways for your replies...
:)