timezone

Android TimeZone Turkey GMT

怎甘沉沦 提交于 2020-01-14 14:19:47
问题 For 2016 Turkish Government decided to stay GMT+3 timezone to save daylight, but on android: Calendar calendar = Calendar.getInstance(); TimeZone tz = TimeZone.getTimeZone("UTC"); calendar.setTimeInMillis(timestamp * 1000); Date currentTimeZone = (Date) calendar.getTime(); calendar.add(Calendar.MILLISECOND, tz.getOffset(calendar.getTimeInMillis())); So the problem is; it's showing GMT+3 for the date before November: Wed Oct 26 18:00:00 GMT+03:00 2016 but for after November: Mon Nov 07 20:00

How to use the MySQL CONVERT_TZ function in a JPQL or HQL query

谁说胖子不能爱 提交于 2020-01-14 13:46:11
问题 I currently have table in a MySQL database which has a startDate and endDate which are both timestamps . This is linked to the code using hibernate. I can return these by using the following HQL SELECT startDate, endDate FROM Reservation where id = :id What I am trying to do is return these dates based on a given timezone. I know MySQL has a function CONVERT_TZ which can return the dates based on a given timezone, I'm wondering if HQL has a similar function? I know HQL has a TIMESTAMP_WITH

How datetime values are stored in mysql?

拈花ヽ惹草 提交于 2020-01-14 12:53:32
问题 I am new to db world. I am sending a datetime value such as '2016-04-27 09:00:00' from java program, for getting it saved into mysql database. My question is that How will this value be saved into datetime type of field in mysql db table. I mean, whether It'll be stored as string as I have passed or mysql will parse the string, and constructs UTC timestamp out of it and store that number into db. Moreover, Will this stored value be retrieved as it is from java program, irrespective of

How datetime values are stored in mysql?

不问归期 提交于 2020-01-14 12:53:16
问题 I am new to db world. I am sending a datetime value such as '2016-04-27 09:00:00' from java program, for getting it saved into mysql database. My question is that How will this value be saved into datetime type of field in mysql db table. I mean, whether It'll be stored as string as I have passed or mysql will parse the string, and constructs UTC timestamp out of it and store that number into db. Moreover, Will this stored value be retrieved as it is from java program, irrespective of

How datetime values are stored in mysql?

孤街浪徒 提交于 2020-01-14 12:52:27
问题 I am new to db world. I am sending a datetime value such as '2016-04-27 09:00:00' from java program, for getting it saved into mysql database. My question is that How will this value be saved into datetime type of field in mysql db table. I mean, whether It'll be stored as string as I have passed or mysql will parse the string, and constructs UTC timestamp out of it and store that number into db. Moreover, Will this stored value be retrieved as it is from java program, irrespective of

Are UtcNow and Now the same datetime? Do they know they're different?

浪子不回头ぞ 提交于 2020-01-14 09:58:12
问题 If I run a snippet like: bool areTheyTheSame = DateTime.UtcNow == DateTime.Now what will I get? Does the DateTime returned know its timezone such that I can compare? My specific problem is that I'm trying to build a cache-like API. If it takes a DateTime AbsoluteExpiration, do I have to enforce that users of my API know whether to give me a UTC time or a timezone-based time? [Edit] This SO question is extremely relevant to my issue as well: Cache.Add absolute expiration - UTC based or not?

PostgreSQL dump and restore in different timezone

只谈情不闲聊 提交于 2020-01-14 09:20:29
问题 I have two databases running on different servers in different timezones. There is a couple of tables which contains timestamp with timezone . I need to dump data from one database and to import it to another with correct timestamp and correct timezone. I use following command to dump data: pg_dump -a DB_NAME > dump.sql I see data are in old timestamp and timezone format: 2013-11-29 14:30:00+02 Then I use command to another server to restore dump: psql -d DB_NAME -f dump.sql And I see that

.Net TimeZoneInfo ID - Is it Windows Language Specific?

落爺英雄遲暮 提交于 2020-01-14 09:10:37
问题 I'm using the .net TimeZoneInfo FindSystemTimeZoneById method which I understand queries the registry. Are the values for Time Zone ID strings stored in the registry at "HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\Time Zone" dependent on the language of the Windows installation of the machine? The registry key contains a value called "Display Name" so it would make sense for this to be the language specific one, but I can't find out if this is the case (short of installing

pytz timezone conversion performance

半城伤御伤魂 提交于 2020-01-14 04:46:10
问题 I have more than 1 million datetime object from database, and I want to convert each of them to timezone-aware datetime objects. Here is my helper funcion conv_tz: # dt is python datetime object, src_tz and dest_tz and pytz.timezone objects def conv_tz(dt, src_tz, dest_tz): if not dt: return None sdt = src_tz.localize(dt) return sdt.astimezone(dest_tz) Here is the result from the profiler: ncalls tottime percall cumtime percall filename:lineno(function) 1101475 1.166 0.000 44.440 0.000 ..

Mongoose saving and retrieving dates with UTC time, change to server timezone

若如初见. 提交于 2020-01-14 04:13:47
问题 I'm using mongoose models to save my records including created and updated dates. Here's my model schema: var CasesModelSchema = new mongoose.Schema( { caseId: Number, sessionId: String, createdAt: {type: Date}, updatedAt: {type: Date, default: Date.now}, docs: mongoose.Schema.Types.Mixed }, { collection: 'cases' } ); The problem I'm facing is that the updatedAt field saves the datetime as ISODate("2017-04-24T12:40:48.193Z") , which is in UTC, but my server's timezone is Asia/Calcutta . Since