timezone

Converting EDT time zone to GMT not working fine in java

馋奶兔 提交于 2019-12-12 16:21:36
问题 I am using this code to parse this date. It must show new date as "2012-06-20 03:09:38" as EDT is -4GMT and my current location is GMT+5. But its not showing this it now showing as it is private static void convertEDT_TO_GMT() { try { String s = "2012-06-20 18:09:38"; SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); df.setTimeZone(TimeZone.getTimeZone("EDT")); Date timestamp = null; timestamp = df.parse(s); df.setTimeZone(TimeZone.getTimeZone("GMT+05:00")); System.out

PHP/MySQL timestamp and timezones

帅比萌擦擦* 提交于 2019-12-12 16:14:22
问题 If I grab the current timestamp using the NOW() function in MySQL can I grab that field via php and give that time in different time zones? Basically converting current time in the current timezone to another timezone? 回答1: You can use the DateTimeZone class: $gmt = new DateTimeZone("GMT"); $datetimeInGMT = new DateTime($now, $gmt); It also takes locations in the form continent/city , e.g. Europe/London . If your datetime is non-UTC, you can use setTimezone : $datetimeInGMT = new DateTime(

How to send out email at a user's local time in .NET / Sql Server?

一笑奈何 提交于 2019-12-12 15:47:58
问题 I am writing a program that needs to send out an email every hour on the hour, but at a time local to the user. Say I have 2 users in different time zones. John is in New York and Fred is in Los Angeles. The server is in Chicago. If I want to send an email at 6 PM local to each user, I'd have to send the email to John at 7 PM Server time and Fred at 4 PM Server time. What's a good approach to this in .NET / Sql Server? I have found an xml file with all of the time zone information, so I am

Postgresql: how to correctly create timestamp with timezone from timestamp, timezone fields

爱⌒轻易说出口 提交于 2019-12-12 15:15:25
问题 I have a table with a timestamp without time zone. YYYY-MM-DD HH:MM:SS and a field "timezone" that is either "P" for Pacific or "M" for Mountain. I need to create a field of type "timestamp with time zone" Given the two fields I have, is there a way to do this that correctly accounts for Daylight Saving Time? Specifically: timestamp: 2013-11-03 01:00:00 timezone: "P" would become: 2013-11-03 01:00:00-07 and timestamp: 2013-11-03 03:00:00 timezone: "P" would become: 2013-11-03 03:00:00-08 回答1:

.Net Framework issue with RTZ2 time zone

僤鯓⒐⒋嵵緔 提交于 2019-12-12 14:01:01
问题 It seems we have found an issue with RTZ2 timezone (Russian Standard Time) in .Net Framework 4.5. If you try to convert time between 2014-01-01 00:00:00 and 2014-01-01 00:59:59 (in RTZ2 timezone) to UTC, you get an error: The supplied DateTime represents an invalid time. For example, when the clock is adjusted forward, any time in the period that is skipped is invalid. Example (https://dotnetfiddle.net/rNbp8F): var rtz2 = TimeZoneInfo.FindSystemTimeZoneById("Russian Standard Time"); var

Rails - Setting time_zone dynamically as per user selection

ε祈祈猫儿з 提交于 2019-12-12 13:47:30
问题 I appreciate your help one of the features working on for my new website! This is regarding the dynamic time_zones as per the requirement user would be able to choose from set of pre-defined time_zones say us_zones. When the user picks the zone the entire site should be set/updated to TimeZone. However, at present the new time zone is not becoming updated into Apache and the updation of time zone happens only at the restart of the server. I was thinking in the lines of using Rails Initializer

lon,lat to timezone

牧云@^-^@ 提交于 2019-12-12 13:41:04
问题 Does anyone know if there is any existing solution for determining a timezone from a point (lon, lat)? i could hard code the few i need for this project but it'd be better to use a pre-built solution. thanks. 回答1: Use a webservice such as the one provided by geonames. Example: http://api.geonames.org/timezone?lat=47.01&lng=10.2&username=demo Returns: ... <timezoneId>Europe/Vienna</timezoneId> ... 回答2: Try this code for use Google Time Zone API: String get_xml_server_reponse(String server_url)

Angular Material Datepicker Timezone ignore?

こ雲淡風輕ζ 提交于 2019-12-12 13:29:10
问题 I'm trying to get a date for flights from the user and the datepicker always sets the date as datetime object with the user's timezone, resulting in a wrong date sent to server. tried to use ng-model-options="{ timezone: 'utc' }" but then the user see the wrong date after choosing the date (the date displayed as a day before what the user chose). How can I tell datepicker to completely ignore timezone - if not possible what can I do on FE / BE to convert this date to non timezone date ? I

Why %z is not supported by python's strptime?

与世无争的帅哥 提交于 2019-12-12 13:18:41
问题 >>> datetime.strptime('2014-02-13 11:55:00 -0800', '%Y-%m-%d %H:%M:%S %z') Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/_strptime.py", line 317, in _strptime (bad_directive, format)) ValueError: 'z' is a bad directive in format '%Y-%m-%d %H:%M:%S %z' I understand that it's not supported, but don't know why. Seems it's not hard to support that. And 'Offset from UTC' is not as ambiguous as

WeBid: Timezones with daylight savings time not calculated correctly

混江龙づ霸主 提交于 2019-12-12 13:13:09
问题 I'm currently using an open source application: WeBid (available here) Here is the issue: The user has a preferred timezone stored in DB The site has a default timezone stored in DB All db stored dates are stored at "GMT-0" The application doesn't calculate the DST (Daylight Savings Time) correctly as it uses the following code: (includes/functions_global.php) $this->ctime = time() + (($this->SETTINGS['timecorrection'] + gmdate('I')) * 3600); $this->tdiff = ($this->SETTINGS['timecorrection']