Is there a function like getdate() that returns the time tuple in GMT instead of local time? Just as date() has gmdate() and mktime() has gmmktime(), I was hoping to find a gmgetdate() but did not.
The clearest distillation of the problem is to execute print_r(getdate(0)). Assuming your local time is not GMT, you will see that you do not get midnight at January 1, 1970. You get your local time translation of midnight on January 1, 1970 GMT.
Even if there is not a single function like gmgetdate() is there a way to get the same functionality?
Thanks.
getdate() with GMT?
Moderator: General Moderators
- Christopher
- Site Administrator
- Posts: 13596
- Joined: Wed Aug 25, 2004 7:54 pm
- Location: New York, NY, US
I think maybe something like the following would work:
But that may just give the same dates as you mentioned. feyd recently posted a massive date class -- thereby anointing himself Chronos() - Lord of Date Functions (usually followed by a thunderclap
). Perhaps he can help.
Code: Select all
getdate( gmmktime() )(#10850)
- feyd
- Neighborhood Spidermoddy
- Posts: 31559
- Joined: Mon Mar 29, 2004 3:24 pm
- Location: Bothell, Washington, USA
Typically when I need time in GMT form, I use
Code: Select all
time() - date('Z')