I'd like to write a function that can convert a time in EST (USEast Standard Time) to a time in another local timezone.
The inputs will be "time in EST" in the form 'Y-m-d H:i:s' (i.e. 2011-08-23 05:05:35), "City" "State", and "Country"
The function should return the local time (i.e. if the city, state, country is San Francisco, California, USA, and time in EST is 2011-08-23 05:05:35, function should return 2011-08-23 02:05:35)
I tried to figure it out from php.net but it seems like I need a continent to specify a timezone...and I didn't know how to convert a country to a continent.
Thanks
To do this, select the cell that contains the date and time that you want to convert. Then click on the Formulas tab and select Insert Function. In the Insert Function dialog box, scroll down until you see the TIMEVALUE function and select it. Click OK.
JavaScript Date getTimezoneOffset() getTimezoneOffset() returns the difference between UTC time and local time. getTimezoneOffset() returns the difference in minutes. For example, if your time zone is GMT+2, -120 will be returned.
SELECT CONVERT(datetime, SWITCHOFFSET(CONVERT(DATETIMEOFFSET, GETUTCDATE()), DATENAME(TZOFFSET, SYSDATETIMEOFFSET()))) AS LOCAL_IST; Here, the GETUTCDATE() function can be used to get the current date and time UTC. Using this query the UTC gets converted to local IST.
the PHP function date_default_timezone_set('EST');
accepts timezone as EST or GMT maybe this can be a good alternative to your problem.
I prefer:
date_default_timezone_set('America/Los_Angeles');
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With