TimeZones in Java

The list of timezones is very application and locale specific. Only you know what zones are most applicable to your users. We actually have different lists for different regions. Here is our list for US users for your reference, “Pacific/Midway”, “US/Hawaii”, “US/Alaska”, “US/Pacific”, “America/Tijuana”, “US/Arizona”, “America/Chihuahua”, “US/Mountain”, “America/Guatemala”, “US/Central”, “America/Mexico_City”, “Canada/Saskatchewan”, “America/Bogota”, “US/Eastern”, “US/East-Indiana”, “Canada/Eastern”, … Read more

Same date in different time zone

Here’s how you could do what you are asking: // get a moment representing the current time var now = moment(); // create a new moment based on the original one var another = now.clone(); // change the offset of the new moment – passing true to keep the local time another.utcOffset(‘+05:30’, true); // log … Read more

PHP Timezone List

Take my array of time zones, which I made specially for select element. It is associated array where key is PHP time zone and value is human representation. This is it: $timezones = array( ‘Pacific/Midway’ => “(GMT-11:00) Midway Island”, ‘US/Samoa’ => “(GMT-11:00) Samoa”, ‘US/Hawaii’ => “(GMT-10:00) Hawaii”, ‘US/Alaska’ => “(GMT-09:00) Alaska”, ‘US/Pacific’ => “(GMT-08:00) Pacific … Read more

Get UTC offset from time zone name in python

Because of DST (Daylight Saving Time), the result depends on the time of the year: import datetime, pytz datetime.datetime.now(pytz.timezone(‘Asia/Jerusalem’)).strftime(‘%z’) # returns ‘+0300’ (because ‘now’ they have DST) pytz.timezone(‘Asia/Jerusalem’).localize(datetime.datetime(2011,1,1)).strftime(‘%z’) # returns ‘+0200’ (because in January they didn’t have DST)