timezone

Zend Date DST Bug: Test whether a date is a “time change” date

房东的猫 提交于 2020-01-07 02:27:07
问题 I found a workaround for Zend Date's DST Bug, but the workaround introduces another bug. The workaround simply sets the time twice. This introduces another bug, if the resulting date crosses the date boundary, the the day get incremented or decremented. I am wondering if there's a way to determine that the date at hand is a "time change" date, so that I can come up with a solid workaround to the Zend Date DST bug. 回答1: It turns out that PHP's function localtime() returns whether or not the

Calculate hours between dates in different time zones

删除回忆录丶 提交于 2020-01-06 20:09:46
问题 I have an array of dates (in different time zones GMT) and I would like to calculate the hours that have elapsed between the first and the last date. For example, this would be an array of dates: [ 1 => 2016-06-05T08:45:00.000+02:00, 2 => 2016-06-05T09:55:00.000+02:00, 3 => 2016-06-05T12:10:00.000+02:00, 4 => 2016-06-05T14:25:00.000-04:00 ] I want to calculate the hours that have elapsed since the date with index 1 to 2, 2 to 3 and from 3 to 4. The problem is I do not know how to calculate

Time zone conversion to CST based GMT offset

試著忘記壹切 提交于 2020-01-06 19:54:36
问题 I have date(01-oct-2014), time (00:37:31), GMT difference(-360) now I want to get the time conveted to CST. The solution can be in javascript Or oracle databse. I have read several articles but could'nt get any where..can some one help me out on this... 回答1: In Oracle, to convert your local time to time of another timezone, you need to CAST TIMESTAMP WITH TIMEZONE . For example, I want to convert 'IST' Indian standard time, i.e. my local timezone to 'CST', i.e. Central : SQL> WITH T AS 2 (

convert time of certain timezone to UTC using momemtjs

≡放荡痞女 提交于 2020-01-06 18:33:48
问题 I have a time in a specific timezone , I want to covert it to UTC . how can I achieve that using moment timezone ? http://momentjs.com/timezone/ in the documentation this is how to convert : jun.tz('America/Los_Angeles').format('ha z'); I am just not sure what timezone name to pass to convert it to UTC, or is there another function to use? 回答1: You can easily construct a moment in a specific time zone by using the moment.tz(...) syntax. This is slightly different from doing conversions with

Converting GMT time to local time using timezone offset, not timezone identifier

不羁岁月 提交于 2020-01-06 07:57:13
问题 It's pretty easy to convert a given GMT date into local time if you're given the timezone identifier from this list in PHP: http://www.php.net/manual/en/timezones.php For example, you can do this (where $fromTimeZone is just 'GMT', $toTimeZone is just one of the constants from that list (i.e. 'America/Chicago'), and $datetime is the GMT date): public static function convertToTimezone($datetime, $fromTimeZone, $toTimeZone, $format = 'Y-m-d H:i') { // Construct a new DateTime object from the

How can I get with the TimeZone the Countryname

ぐ巨炮叔叔 提交于 2020-01-06 07:49:25
问题 I have the timezone. I have the city. How can I get the country? Set<String> ids = DateTimeZone.getAvailableIDs(); for (String id : ids) { System.out.println(" "+id); } 回答1: There could be multiple countries per timezone, but if you want to print a list, I'd suggest putting them into a collection.. perhaps a two dimensional array. http://www.timezoneconverter.com/cgi-bin/zonehelp.tzc ======================= Based on your feedback and how your question changed, you should be able to use Google

change time zone in R without it returning to original time zone

北战南征 提交于 2020-01-06 07:14:20
问题 I have a df with dates and times like this: df <- data.frame(c("2018-09-28 00:00:00Z","2018-09-29 01:00:00Z","2018-09-30 10:00:00Z")) names(df) <- "startTime" The dates and times are in UTC time zone, so I format like this: df$startTime <- as.POSIXct(df$startTime, tz="Etc/UTC") I then want to put them in New York time, like this: attributes(df$startTime)$tzone <- "America/New_York" Now I want to extract just the date using as.Date. Unfortunately, the code below returns the dates to the UTC

Get proper time from client-supplied timestamp (and timezone)

爱⌒轻易说出口 提交于 2020-01-06 05:39:10
问题 I have a typical php/html/javascript application. There is one main HTML page with a lot of javascript and AJAX calls to PHP to receive/send data. Among other things, the app tracks certain user actions, recording what the action is and the timestamp of the action. I'm getting the timestamp in javascript as new Date().getTime() . I send the action log to the server, which uses $dt = date('h:i:s', timestamp / 1000) to get a human-digestable time. (Note that for printing purposes I'm only

How to treat date-input and time-input as local time, rather than universal time?

左心房为你撑大大i 提交于 2020-01-06 05:24:31
问题 a date input where the user enters 2019-12-22 gives these values: input.value : "2019-12-22" input.valueAsNumber : 1576972800000 input.valueAsDate : "Sat Dec 21 2019 16:00:00 GMT-0800 (Pacific Standard Time)" this resulting date object just seems wrong when the browser returns a value, it treats the user input as universal time so the date object's utc representation is the same as what the input displays to the user input.valueAsDate.getUTCDate() returns 22 , which is what the user entered

Format String yyyy-mm-dd hh:mm:ss +timezone into DateTime

僤鯓⒐⒋嵵緔 提交于 2020-01-06 04:46:06
问题 I need to format a String that looks like this: "2018-07-20 18:53:46.598000 +02:00:00" into a DateTime object like this: 20/07/2018 (HH with Timezone applied):53:46 My approach has been: String dateTimePattern = "dd/MM/yyyy HH:mm:ss"; SimpleDateFormat dateTimeFormat = new SimpleDateFormat(dateTimePattern); Date feUltModDateTime = dateTimeFormat.parse(feUltMod); feUltMod = feUltModDateTime.toString(); But I'm getting a parse error: java.text.ParseException: Unparseable date: "2018-07-20 18:53