timezone

What's the point of using wordy Time Zones?

大城市里の小女人 提交于 2020-01-24 08:59:06
问题 I know this isn't specific to PHP, but what's the point of using timezones listed like this :http://us2.php.net/manual/en/timezones.america.php? For example "America/Indianapolis" and "America/New_York". What is the problem with EST, EDT, CST, CDT, &c? 回答1: This is just a different timezone format provided by the Zoneinfo database: The time zones in the database are given uniform names, such as “America/New_York”, in an attempt to make them easier to understand by humans and to remove

Wrong offset for TimeZone casablanca (java)

牧云@^-^@ 提交于 2020-01-24 08:01:05
问题 I am trying to build a date (29/07/2014 at 02:55:08 am) in Casablanca timezone and got this exception: Exception in thread "main" java.lang.IllegalArgumentException: HOUR_OF_DAY: 2 -> 3 at java.util.GregorianCalendar.computeTime(Unknown Source) Calendar cal = GregorianCalendar.getInstance(TimeZone.getTimeZone("Africa/Casablanca")); cal.setLenient(false); cal.set(Calendar.DATE, 29); cal.set(Calendar.MONTH, 6); // July cal.set(Calendar.YEAR, 2014); cal.set(Calendar.HOUR_OF_DAY, 2); cal.set

JavaScript - difference between Date(), new Date(), and ISODate

泪湿孤枕 提交于 2020-01-24 06:37:05
问题 I've seen various versions of this question, but none of them answer my needs. I want to create an ISODate for MongoDB and I'm using Node.js. In Node, when I do: console.log(Date()); I get: Mon Sep 26 2016 15:17:04 GMT-0400 (EDT) <-- This is correct. When I do: console.log(new Date()); I get: 2016-09-26T19:17:04.731Z <- This is 4 hours ahead My understanding of the way to do ISODATE is: var isodate = new Date().toISOString() console.log(isodate); Which yields a time 4 hours ahead of "now". My

Convert to local time zone from latitude and longitude R

牧云@^-^@ 提交于 2020-01-23 19:45:55
问题 I have one data frame with a lot of locations (around 30.000), and I need to convert the time of each location for the local time. I tried some ideas like this one, and this one. But they did not work for me. I have data like this: dt = data.table(date = c("2018-01-16 22:02:37", "2018-01-16 22:54:00", "2018-01-16 23:08:38"), lat = c(-54.5010, -54.5246, -54.5285), long = c(-25.0433, -25.0929, -25.0832)) And I expected this output: date lat long 2018-01-16 20:02:37 -54.5010 -25.0433 2018-01-16

Java Calendar wrong time for PST time zone?

我的梦境 提交于 2020-01-23 17:49:06
问题 Playing around with Calendar and TimeZone I encountered following strange behaviour. Calendar pstCal = Calendar.getInstance(TimeZone.getTimeZone("PST")); System.out.println("H: "+ pstCal.get(Calendar.HOUR)); At the moment of writing this post, PST time according to http://www.timeanddate.com/time/zones/pst is 1:39am. The code shown above however produces output " H: 2 " Why 2 instead of 1 ? Closer look at the Calendar instance explains the number 2: dstSavings=3600000,useDaylight=true But

Timezone and more problems with Cakephp 1.3 and PHP 5.3.2

一个人想着一个人 提交于 2020-01-23 04:26:48
问题 on server i have php 5.3.2, and cakephp 1.3. when i run cakephp application, it gives me following errors: Warning (2): strtotime() [http://php.net/function.strtotime]: It is not safe to rely on the system's timezone settings. You are required to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'Europe/Berlin' for 'CEST/2.0/DST

Convert an NSDate to a Unix timestamp using a particular time zone

前提是你 提交于 2020-01-23 01:43:13
问题 I am trying to get the Unix timestamp using a particular time zone (not necessarily the same time zone as the system) I tried this : NSDateFormatter *dateFormatter = [[[NSDateFormatter alloc] init] autorelease]; [dateFormatter setDateFormat:@"yyyy-MM-dd HH:mm:ss"]; NSTimeZone *gmt = [NSTimeZone timeZoneWithName:@"Australia/Melbourne"]; [dateFormatter setTimeZone:gmt]; NSString *timeStamp = [dateFormatter stringFromDate:[NSDate date]]; NSDate *curdate = [dateFormatter dateFromString:timeStamp]

AngularJS date filter is adding unexpected timezone offset?

 ̄綄美尐妖づ 提交于 2020-01-22 02:31:27
问题 Docs: https://docs.angularjs.org/api/ng/filter/date Plunker: https://plnkr.co/edit/q6KPNejv52SzewDlvGyu?p=preview Code snippet below: var app = angular.module("app", []); app.controller("ctrl", function($scope, $interval) { $scope.message = "It works!"; $scope.dateStart = new Date(); $interval(function() { $scope.dateNow = new Date(); }, 42) }); <script src="https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.6.9/angular.min.js"></script> <div ng-app="app" ng-controller="ctrl"> {{ message }}

Convert Date by TimeZone

跟風遠走 提交于 2020-01-21 19:44:54
问题 In that code above I want to transform a Date by the TimeZone of Server (GMT-02:00) to TimeZone from my Device (GMT-03:00). But I Always have the same Date of the server. What I doing wrong? TimeZone timeZoneServer = TimeZone.getTimeZone(timeZoneServerString); Long time = new Long(Long.valueOf(timeInMilis)); Calendar calendarDateServer = Calendar.getInstance(timeZoneServer); calendarDateServer.setTimeInMillis(time); long miliServer = calendarDateServer.getTimeInMillis(); TimeZone timeZoneMeu

Convert Date by TimeZone

风流意气都作罢 提交于 2020-01-21 19:44:05
问题 In that code above I want to transform a Date by the TimeZone of Server (GMT-02:00) to TimeZone from my Device (GMT-03:00). But I Always have the same Date of the server. What I doing wrong? TimeZone timeZoneServer = TimeZone.getTimeZone(timeZoneServerString); Long time = new Long(Long.valueOf(timeInMilis)); Calendar calendarDateServer = Calendar.getInstance(timeZoneServer); calendarDateServer.setTimeInMillis(time); long miliServer = calendarDateServer.getTimeInMillis(); TimeZone timeZoneMeu