timezone

Convert Local Time Zone to PST Time Zone in C#

限于喜欢 提交于 2019-12-22 05:18:18
问题 Let say my time zone in system right now is +5GMT right now on my machine 01/14/2012 05:52PM I want to convert it into PST time zone like 1/14/12 4:52:50 AM PST and vice versa PST to GMT 回答1: TimeZoneInfo timeZoneInfo = TimeZoneInfo.FindSystemTimeZoneById("Pacific SA Standard Time"); DateTime newDateTime = TimeZoneInfo.ConvertTime(existingDateTime, timeZoneInfo); You can see complete chart of available Time Zones here Also take a look at Converting Between Any Two Time Zones 回答2: Inspired by

UTC vs. GMT - Java vs. .Net

丶灬走出姿态 提交于 2019-12-22 05:09:20
问题 In .Net UTC and GMT are not the same Difference between UTC and GMT Standard Time in .NET Is it the same with Java? Does Java has the notion that GMT has DST changes while UTC doesnt? Thanks! 回答1: Daylight Saving Time and GMT is different. GMT is GMT, wherever and whenever. GMT+0 is standard British Time GMT+1 is BST (British Summer Time) 回答2: As the documentation explains, GMT is equivalent to UT and the difference between UT and UTC is "is an invisibly fine hair to split". As Codemwnci

Incorrect timezone in Firefox, compared to Safari, using javascript Date()

ぐ巨炮叔叔 提交于 2019-12-22 05:06:45
问题 The following code var date = new Date(); console.log( date ); gives me Sun Mar 06 2011 21:41:36 GMT+1300 (NZST) {} in Firefox, but Sun Mar 06 2011 21:40:51 GMT+1300 (NZDT) in Safari (which is correct). My system Date & Time is set to NZDT, so I'm wondering where firefox is getting its NZST from. Mind you, the UTC offset (+1300) is correct in both cases. How can I get Firefox displaying the correct timezone: NZDT? 回答1: You shouldn't rely on that output as it's different in other browsers (IE)

.net JSON serializer returns local client time to browser?

血红的双手。 提交于 2019-12-22 04:54:08
问题 I use an asp.net [WebMethod] to push a .net object back to the Ajax call on a browser. One of the properties of the object is of a DateTime type. When it arrives at the browser the time is seven hours before the time that is stored in the SQL Server. Okay, so my browser is in Peru (GMT-5) and the server is in Germany (currently GMT+2), that's where the 7 hours come from. As a fix I send the UTC offset on the client with the Ajax request d = new Date(); d.getTimezoneOffset(); then on the

PHP date_default_timezone_set()

断了今生、忘了曾经 提交于 2019-12-22 04:38:16
问题 In php, is there a way to set default timezone in .htaccess or wherever, as long as i don have to set it at every php page. provided i don have access to server, only PHP files. Thanks in advance UPDATE i am using apache (LAMP), and don't have access to php.ini 回答1: Considering you use apache from the fact you mention .htaccess: Yes, as long as it runs mod_php it is possible in .htaccess like so: php_value date.timezone "Europe/Berlin" Or you could set date.timezone in php.ini like Karl

TimeZoneInfo vs. Olson database

こ雲淡風輕ζ 提交于 2019-12-22 03:48:52
问题 Do TimeZoneInfo and Olson database use identical identificators for time zones? I get timezone id from GeoNames service (which is based on Olson database) and want to retrieve day light saving information for that timezone. 回答1: The unicode consortium keeps a mapping between Olson database and Windows TimeZone Ids, which can be accessed here. Also see this SO question and answers for more daylight savings info (Daylight saving time - do and don’ts). 回答2: No they don't use the same identifiers

How to compute the time difference between two time zones in python?

℡╲_俬逩灬. 提交于 2019-12-22 03:48:50
问题 How can I compute the time differential between two time zones in Python? That is, I don't want to compare TZ-aware datetime objects and get a timedelta ; I want to compare two TimeZone objects and get an offset_hours . Nothing in the datetime library handles this, and neither does pytz. 回答1: The first thing you have to know is that the offset between two time zones depends not only on the time zones in question, but on the date you're asking about. For example, the dates on which Daylight

How to get timezone from country

眉间皱痕 提交于 2019-12-22 01:32:22
问题 I am converting a function from PHP to Go. I want to get timezone from country code in Go. It is similar this function in PHP public static array DateTimeZone::listIdentifiers ([ int $what = DateTimeZone::ALL [, string $country = NULL ]] ) Which function have similar feature in Go? 回答1: The Go standard library does not have a function for this. Look for an open-source Go package that does this for you. Or, since this is Go, write a simple Go function yourself. You will have to download the

Django default=timezone.now + delta

那年仲夏 提交于 2019-12-22 01:23:35
问题 Trying to set a timestamp for a key expiration in Django model and bumped into this issue : My current code : key_expires = models.DateTimeField(default=timezone.now() + timezone.timedelta(days=1)) The code above works, however when "timezone.now()" is used, it gets the timestamp form the time when Apache was restarted, so this doesn't work. I did some research and found the solution for that part of the issue, so by replacing "timezone.now()" with "timezone.now", I'm getting the current time

Can JDBC + MySQL be convinced to ignore timezones?

心已入冬 提交于 2019-12-21 23:03:22
问题 I've got a Java web application in which the client sends timestamped data to the server to be stored in a MySQL database and retrieved later. These timestamps should always be treated as local time and never adjusted for timezone: If a client in one timezone inputs a time of 18:00:00, it should display for a client in another timezone as 18:00:00. The database column holding this value is of type DATETIME, as I was under the impression that it does no timezone-adjusting. The java application