timezone

Rails Form display datetime at local timezone

倾然丶 夕夏残阳落幕 提交于 2019-12-11 11:03:03
问题 I'm new to rails (just finished the Rails Tutorial) and I'm building my first solo app. The user can create 'events' at specific times. Currently the user form is in UTC. How do I set it to their local time? I don't just want to change it after they submit, because it would be confusing for the user. When you open a new form the default time is the current time (currently UTC). I want that to be the time of their local timezone. <%= f.label :Date_Time %><br /> <%= f.datetime_select :date %>

Getting the system's time zone with Dragon NaturallySpeaking's Advanced Scripting

纵然是瞬间 提交于 2019-12-11 10:39:03
问题 I want to display the current date and time with Dragon NaturallySpeaking's Advanced Scripting: I display the date and the time as follows: Sub Main DateToday$ = Format(Now,"yyyy-mm-dd hh:nn:ss") SendKeys DateToday$ End Sub It outputs something like "2015-01-19 21:45:07". How can I write the system's time zone as well? I use Dragon NaturallySpeaking 12.5 Professional with Windows 7 SP1 x64 Ultimate. 回答1: Well, see my answer here: https://stackoverflow.com/a/44507647/5521857 So, have Dragon

Timezone or location to UTC offset

非 Y 不嫁゛ 提交于 2019-12-11 10:16:09
问题 I need library that can convert time zone to utc offset. I have list of Americans cities, and I know their zones (PST, EST ....) and locations. So my strategy can be library.getOffset('city location') myLibraryOrOtherLibrary.getOffset('EST') I know about library moment.js .But library doesn't support all Americans cities for something like below moment().tz("America/Los_Angeles").format(); Should I implement something myself or there is some other library or I can use moment.js in some other

What browsers support timezone conversion automagic?

天大地大妈咪最大 提交于 2019-12-11 09:59:42
问题 This example should display "Mon Dec 25 1995 07:30:00 GMT-0600 (CST)" if you're on a -6 time: (new Date('Mon, 25 Dec 1995 13:30:00 GMT')) or js fiddle: http://jsfiddle.net/nFADG/ Is this sort of conversion supported in IE and older Firefoxes? For all the crazy methods that a google search offers to convert timezones in js one might start thinking there's something wrong with this one. Edit: removed the toLocaleString() to avoid confusion. Edit: changed the date string to reflect the IETF

Daylight Savings Time wrongly identified by Node.js

青春壹個敷衍的年華 提交于 2019-12-11 09:47:19
问题 I'm having an issue with timezones, DST and Node.js. It doesn't identify correctly DST effects. My OS is Windows 8.1 and have the timezone value and DST well set. I tried these two methods: 1) Node's Date Object I typed the following code in Node Prompt and received the answer in italic: new Date() Tue Sep 09 2014 18:42:36 GMT-0200 (Horário brasileiro de verão(Brazilian Daylight Savings Time)) However, the brazilian DST starts just in Oct 19th, we are not in DST right now. Therefore, the hour

Converting datetime from one time zone to another using pytz

一笑奈何 提交于 2019-12-11 09:37:43
问题 I have a data set which includes date/timestamps from New York WITHOUT timezone information. EDT or EST are not recorded. Dates include daily data for several years, so it includes both: EDT Timezone EST Timezone I want to translate those date/timestamps to Frankfurt time. This involves using: CET Timezone CEST Timezone Depending on the specific date. I have seen that for the NY time, pytz includes timezone('US/Eastern') , which if I understood correctly includes both timezones (New York

Why SimpleDateFormat.format() and SimpleDateFormat.parse() are giving different time though setting only one TimeZone?

守給你的承諾、 提交于 2019-12-11 09:15:19
问题 I am trying to set the Timezone to the different country's timezone with help of SimpleDateFormat . SimpleDateFormat.format() returns correct current time of the given Timezone, but SimpleDateFormat.parse() returns local current time, I dont know why this is happening. Here is the my code - SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:MM:ss"); dateFormat.setTimeZone(TimeZone.getTimeZone("America/Los_Angeles")); System.out.println("Time1 : " + dateFormat.format(new Date())

I'm trying to build an RFC3339 timestamp in C. How do I get the timezone offset?

回眸只為那壹抹淺笑 提交于 2019-12-11 09:07:09
问题 I'm attempting to put together an RFC3339 timestamp which will be used to write a certain entry to a database. That would be formatted as, for example, 2004-10-19 10:23:54+02, where the +02 is the offset in hours from GMT. It's this offset which is proving troublesome - I can't seem to derive this value in C. Here is the code I'm using. When I try to build, it says the tm struct doesn't have a member named tm_gmtoff: #include <time.h> #include <stdio.h> int main(void) { time_t now = time(NULL

Why isn't the offset of Samoa +13 or +14 when using pytz?

回眸只為那壹抹淺笑 提交于 2019-12-11 08:58:32
问题 I've just read BBC: Samoa and Tokelau skip a day for dateline change, 30.12.2011 I wanted to see this with pytz , but everything I tried only showed an offset of -11, but not of +13 or +14: >>> import pytz >>> tz = pytz.timezone('Pacific/Samoa') >>> tz_us = pytz.timezone('US/Samoa') >>> import datetime >>> datetime.datetime(2011, 12, 30, 9, 00, tzinfo=datetime.timezone.utc).astimezone(tz).isoformat() '2011-12-29T22:00:00-11:00' >>> datetime.datetime(2011, 12, 30, 10,00, tzinfo=datetime

Joda DateTime DateTimeZone

别等时光非礼了梦想. 提交于 2019-12-11 08:51:57
问题 +I have a time tracking app that uses joda DateTime to persist Start/End time with ORM-lite. ORM-lite stores a Joda DateTime as long in database by using its millis. Joda DateTime.getMillis() returns Milliseconds in UTC. In a few days we switch from daylight-saving time to normal time and I'm not 100% sure if my app will handle this correctly. To test it I tried to disable the "Automatic date & time (Use network-provided time)" setting of my device and changed the date to one that has normal