timezone

MySQL, Rails ActiveRecord date grouping and timezones

老子叫甜甜 提交于 2019-12-23 21:03:16
问题 I want to count users by creation date. When I query my last user, I have: > User.last.created_at => Thu, 07 Aug 2014 21:37:55 BRT -03:00 When I count users per date I get this: > User.group("date(created_at)").count => {Fri, 08 Aug 2014=>1} The creation date is Aug 7, but the result is Aug 8. This is happening because the group condition is in UTC and my timezone is 'Brasilia'. I have this in my application.rb : config.time_zone = 'Brasilia' config.active_record.default_timezone = :local How

Find time zone from IP address

风格不统一 提交于 2019-12-23 19:54:54
问题 Is there a way to find the time zone a user is in when all I have is their IP address? I'm looking for the time offset I need to apply to the server time in order to find the time for the user's location. 回答1: You'll need to attempt to determine the location (which is far from 100% accurate). See this question about doing just that. See this question about translating a zip code into time zone (though that, again, is not 100% fool proof). The short version is: it's complicated. You'll have to

Converting normal datetime to a time zone in sql server 2008

浪子不回头ぞ 提交于 2019-12-23 18:53:40
问题 I have a column which is of datetime data type. It contains few entries. So while getting the value from the select statement I want to output with Time zone. Please help me for example 2007-05-08 12:35:29.1234567 +05:30 (GMT) 回答1: Cast it to dtaetimeoffset like select CAST(dt as datetimeoffset) from test EDIT: you can then use SWITCHOFFSET to get into the specified timezone. For your example select switchoffset(CAST(dt as datetimeoffset),'+05:30') from test Results in 2011-11-24 23:26:30

get helsinki local time regardless of local time zone

不问归期 提交于 2019-12-23 17:50:08
问题 i really need to get Helsinki and Moscow current time using javascript but regardless of local timezone. I wonder how to do that? Maybe anyone has an example? The format would be: November 1, 2011 21:31:00 thank you. 回答1: The following function works when you know the offset ahead of time: var MOSCOW_OFF = 4; // hours var MONTHS = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"]; // desired format => November 1, 2011 21

What are the disadvantages to using ctime's tzset?

左心房为你撑大大i 提交于 2019-12-23 17:24:09
问题 In a question about getting a system's time zone, this answer did not get up-voted. It suggests the use of tzset() and some system globals (e.g. daylight , timezone , and tzname ) from time.h . After some testing, I was able to get accurate results from this method on both Windows and Mac. But I'm guessing the answer mentioned above was not up-voted for a reason. Is this true? Should I prefer OS-specific calls instead of this C-standard? 回答1: No, if there is not an standard C function (and

Detect if ZONEINFO fails in Go

自古美人都是妖i 提交于 2019-12-23 15:47:24
问题 In Go, you can specify a specific zoneinfo.zip file to be used by adding a ZONEINFO environment variable that points to the specific file you'd like to use for time zone information. This is great as it allows me to ensure that the versions of the IANA time zone database that I'm using on my front-end and my back-end are the same. However, there does not appear to be any way to detect if use of the specified zone info file has failed. Looking at the source code (https://golang.org/src/time

Wrong Azure Website server timezone data

南楼画角 提交于 2019-12-23 14:55:28
问题 I'm from Russia, and 1,5 days ago (at 2AM, Oct 26) our timezone (ok, offset of our timezone) has changed - from UTC+4 became UTC+3. Please, don't ask why now - it's out ******* goverment :( But it changed. My home Win 8.1 machine updated automatically. But only one (!) of my Azure resources is updated. One Cloud Service updated, while one more Cloud Service and 4 websites are not updated - they are still at UTC+4 offset. I know, all Azure servers are in UTC in settings, but I speak about

How to get the time zone or local time of Alexa device

99封情书 提交于 2019-12-23 14:47:48
问题 I want to get the "time zone" set in the settings or local date time of the Alexa device. Is there any API available for it? Or is there any option to get the date-time of the user using his postal code? Any help will be highly appreciable? 回答1: Yes, there is a native Alexa API that you can use. Here is a perfect solution for what you're looking for. What you will need is a device ID and an API access token. Also, few tools like axios ( npm i axios) and zip-to-country-code (npm i zipcode-to

How to get the time zone or local time of Alexa device

本小妞迷上赌 提交于 2019-12-23 14:45:52
问题 I want to get the "time zone" set in the settings or local date time of the Alexa device. Is there any API available for it? Or is there any option to get the date-time of the user using his postal code? Any help will be highly appreciable? 回答1: Yes, there is a native Alexa API that you can use. Here is a perfect solution for what you're looking for. What you will need is a device ID and an API access token. Also, few tools like axios ( npm i axios) and zip-to-country-code (npm i zipcode-to

Switch Timezone for calculation

浪尽此生 提交于 2019-12-23 13:53:32
问题 Our application is storing all dates in UTC Timezone. Our Major-Business Unit however is in "Europe/Berlin" Timezone (+2, +1 depending on daylight saving). Therefore, when we determine what "month" a certain Timespan should equal, we want to use THAT Timezone. I.e. The period given by the start Thursday, 31 October 2013, 23:00:0 UTC and end Friday, 29 November 2013, 23:00:00 UTC should bee globaly known as Nov 13 , as for our Major Business Unit, the Times would be Friday, 1 November 2013, 00