local to gmt function doesn't work |
First, I think you misread my post. I did the var_dump WITHIN the function NOW()
and not from where I was calling the function Second: After some searching I found this on Stack Overflow Quote:To convert a string representation of a time into a time_t value, use strtotime. If the string contains a time zone reference, strtotime will do the conversion for you. If not, you can use date_default_timezone_set to tell PHP what timezone to use when interpreting the string. So when converting a local time to GMT time, the date time string that is converted to a timestamp should have the timezone included when using strtotime(). If the timezone is not present when using strtotime, strtotime will use the default timezone of the server. When you use NOW(), you are asking for the current date and time for the set timezone. Converting that value to GMT makes no sence, because it will return the current GMT To get the current GMT time, just call local_to_gmt() without passing a value to the function To convert a stored date time to GMT see this example PHP Code: // If your local date is Hope my explanation is clear |
Messages In This Thread |
local to gmt function doesn't work - by ardavan - 07-11-2017, 06:41 AM
RE: local to gmt function doesn't work - by Martin7483 - 07-11-2017, 01:51 PM
RE: local to gmt function doesn't work - by ardavan - 07-11-2017, 06:29 PM
RE: local to gmt function doesn't work - by skunkbad - 07-11-2017, 06:47 PM
RE: local to gmt function doesn't work - by ardavan - 07-11-2017, 07:21 PM
RE: local to gmt function doesn't work - by skunkbad - 07-11-2017, 07:52 PM
RE: local to gmt function doesn't work - by Martin7483 - 07-12-2017, 01:07 AM
RE: local to gmt function doesn't work - by ardavan - 07-12-2017, 09:03 AM
RE: local to gmt function doesn't work - by Martin7483 - 07-13-2017, 02:31 AM
|