Posts

Showing posts with the label timezone

Daylight Savings Timezone Detection From Strings In JavaScript

Image
Clash Royale CLAN TAG #URR8PPP Daylight Savings Timezone Detection From Strings In JavaScript I've looked in several places but I could not find a solution to this problem. I have some data I'm trying to import and for my case, it contains strings representing dates which are in the Eastern Time Zone (ET). Strings look like this: July 28, 2018 03:39 PM If I try to create a new date object in JavaScript, I can create the new date object, but the problem is that there is no ET timezone, so I can create it either using EST (Eastern Standard Time) or EDT (Eastern Daylight Time). ET EST EDT console.log(new Date('July 28, 2018 03:39 PM EST')); 2018-07-28T19:39:00.000Z Or console.log(new Date('July 28, 2018 03:39 PM EDT')); 2018-07-28T20:39:00.000Z We can clearly see there is one hour difference between both. The rules to determine if Daylight Saving is active or not seems quite complex and can vary from geographic region. So my question is: is there any solution ou...

Oracle session timezone: Can Oracle DB session convert java.sql.Date to correct timezone?

Image
Clash Royale CLAN TAG #URR8PPP Oracle session timezone: Can Oracle DB session convert java.sql.Date to correct timezone? We have an audit table( Columns/Types: ID/Number,.. Audited_Date/Date) which logs audit entries using prepared statements. Until now, for different contexts we set the database session timezone for the connection, after which we were using the CURRENT_DATE attribute for the audited_date column. THIS MEANT THAT THE DATE INSERTED INTO THE COLUMN IS IN THE TIMEZONE OF THE CONNECTION WHICH IS IMPORTANT. Now, we have a new requirement to add different dates based on the supplied timestamps for the audit logs. Similar to the previous approach where the auditing engine didn't have to worry about the timezone, is there a way to set the date for the column, WITHOUT having to do something like this: TimeZone timeZone = TimeZone.getTimeZone(timezone); calendar.setTimeZone(timeZone); preparedStatement.setDate(4, new java.sql.Date(userTimestampMillis), calendar); I would real...

fixed offset specifications of a GMT timestamp

Image
Clash Royale CLAN TAG #URR8PPP fixed offset specifications of a GMT timestamp My data is stored with a timestamp in Greenwich Mean Time (GMT): import pandas as pd import pytz # data is stored in UTC timestamp_utc = pd.Timestamp('2018-1-18 23:00', tz='Etc/GMT') print(timestamp_utc) 2018-01-18 23:00:00+00:00 Now I would like to view my data in Central European Time (CET), which has a fixed offset of +1 hour to GMT. # Central European Time (CET) cet_tz = pytz.timezone('Etc/GMT+1') timestamp_cet = timestamp_utc.astimezone(cet_tz) print(timestamp_cet) 2018-01-18 22:00:00-01:00 This is very confusing for me, I would have expected 2018-01-19 00:00:00+01:00 . 2018-01-19 00:00:00+01:00 In the documentation the following is mentioned on fixed offsets: Fixed offsets The 'Etc/GMT*' time zones mentioned above provide fixed offset specifications, but watch out for the counter-intuitive sign convention. Can anybody explain what this means? Does it really mean, tha...