timezone

PHP DateTime Timezones - Constructor vs Setter method

微笑、不失礼 提交于 2019-12-19 21:41:34
问题 When using the PHP DateTime class and try to set a DateTimeZone I get different results depending on how I set it: using the DateTime::__construct or using the DateTime::setTimezone method. here is an example: $date = '2014-08-01' $dateTimeOne = new DateTime($date, new DateTimeZone('America/Los_Angeles')); echo $dateTimeOne->format('Y-m-d\TH:i:sP'); // 2014-08-01T00:00:00-07:00 $dateTimeTwo = new DateTime($date); $dateTimeTwo->setTimezone(new DateTimeZone('America/Los_Angeles')); echo

PHP DateTime Timezones - Constructor vs Setter method

旧街凉风 提交于 2019-12-19 21:40:29
问题 When using the PHP DateTime class and try to set a DateTimeZone I get different results depending on how I set it: using the DateTime::__construct or using the DateTime::setTimezone method. here is an example: $date = '2014-08-01' $dateTimeOne = new DateTime($date, new DateTimeZone('America/Los_Angeles')); echo $dateTimeOne->format('Y-m-d\TH:i:sP'); // 2014-08-01T00:00:00-07:00 $dateTimeTwo = new DateTime($date); $dateTimeTwo->setTimezone(new DateTimeZone('America/Los_Angeles')); echo

Change timezone component of TIMESTAMP WITH TIMEZONE in Oracle

早过忘川 提交于 2019-12-19 19:54:40
问题 I have some data that is stored in a TIMESTAMP(6) WITH TIMEZONE column in Oracle, but it is stored in the wrong timezone. By convention, all timestamps in the DB must be stored in UTC, but this data was incorrectly persisted as EDT. The actual values are equivalent to the correct UTC value; the problem is simply that it is stored as 19-JUN-12 12.20.42.000000000 PM AMERICA/NEW_YORK when instead it should be 19-JUN-12 16.20.42.000000000 PM UTC . Is there any way in Oracle to change this? 回答1:

javascript date - preserve timezone offset

人走茶凉 提交于 2019-12-19 18:29:21
问题 I have a ISO8601 date that contains a timezone offset (see below). When I create a Date object from this, the date object is converted into my timezone (currently GMT), and timezone offset goes to 0. Is there any way to get the Date() constructor to preserve the timezone offset? var date = new Date("2012-01-17T12:55:00.000+01:00"); console.log(date.toString()); The output I get is: "Tue Jan 17 2012 11:55:00 GMT+0000 (GMT)" The output I want is: "Tue Jan 17 2012 12:55:00" 回答1: Not with the

How to print out time zone abbreviations when using offset hours in Joda Time?

柔情痞子 提交于 2019-12-19 17:41:32
问题 I'm using Joda Time, and I'm being passed DateTimeZones that are created using DateTimeZone.forOffsetHours() . I'd like to print these timezones using standard timezone acronyms such as "PST", "EST", etc. However, whenever I print DateTimes that use these timezones, I get an "hh:mm" representation of the timezone instead of the name acronym. Here's an example: public class tmp { public static void main( String args[] ) { // "PST" System.out.println( DateTimeFormat.forPattern("z").print( new

How to insert datetime with timezone to SQLite?

天大地大妈咪最大 提交于 2019-12-19 16:35:36
问题 I know that to insert a datetime this format yyyy-mm-dd hh:mm:ss should be used. However my dataset has a timestamp field that looks like yyyy-mm-dd hh:mm:ss +/-0X:00 , where X can take many values and is different from my computer's local timezone. What is the best way to insert a datetime field with such timezone information to SQLite? 回答1: SQLite's built-in date and time functions understand the timezone specification in these strings, but with different timezones, any other operations on

How to execute code at a given time every day?

血红的双手。 提交于 2019-12-19 11:16:49
问题 I am trying to add a feature to my program that will execute code every day after the closing of the futures markets in Chicago. This means that I want to run code at around 5:35 Eastern Time (4:35 Central Time where the markets are located). This of course will be switching back and forth between EST (UTC -5) and EST (UTC -4) as Daylight Saving Time occurs. I know there are many similar questions, however none of them seem to offer a solution that I can use. The primary suggestions seem to

Set Browser Time zone (more than four letters) [duplicate]

ε祈祈猫儿з 提交于 2019-12-19 10:54:10
问题 This question already has answers here : How to use a custom time in browser to test for client vs server time difference (7 answers) Closed last year . SET TZ=AEST -9 "c:\Program Files (x86)\Mozilla Firefox\firefox.exe" Test against: https://whoer.net/ . Notice how it displays AES and not AEST and the -9 does not get recognized. Not really sure if there is a workaround for this and the fact you can change your OS time through your browser is amazing. But thought I'd ask, has anyone gotten

How to compare DateTime values, taking into account timezone?

泄露秘密 提交于 2019-12-19 09:41:33
问题 I have two DateTime variables. Each has a timezone stored in the variable so that when I ToString with format including zzz I get a string including +01:00 . At design time I do not know what the timezones will be and I am expecting the variables to have different timezones from each other. I want to compare the two DateTime values so that I know which is more recent. For example, if variable A is 2015-07-04T02:00:00+03:00 and variable B is 2015-07-03T18:00:00-07:00 then B > A. What do I

How do I get a user's date/time or timezone information for an Alexa Skill?

孤街浪徒 提交于 2019-12-19 09:09:56
问题 I'm using Lambda (Python) to develop a skill and I'm interested in giving the user some time-related information. On the request object there is a timestamp but that is UTC without offset. Is there a way to find the user's date/time or timezone without having to ask for location information (and if that's the only way, do you know of a database of US zip codes to timezone or another workaround?). 回答1: It is now possible to get the user's timezone using the Alexa Settings API. See the related