timezone

.NET get timezone by city or by longitude and latitude [duplicate]

随声附和 提交于 2019-12-10 20:06:37
问题 This question already has answers here : How to get a time zone from a location using latitude and longitude coordinates? (15 answers) Closed 8 months ago . I'm using .NET and I'm able to geolocate user city by IP. Is there easy way to get user timezone by long. and lat. or city name? I wonder how facebook is doing it? Thank You 回答1: There is a web service you can use to get the timezone by city or longitude and latitude: http://www.earthtools.org/webservices.htm#timezone 回答2: You can get a

Rails 3 user timezones

巧了我就是萌 提交于 2019-12-10 19:34:12
问题 In Rails 2.x I didn't specifically have to set any timezone info and the user, no matter what timezone they were in, would get the datetime specified by the user in their OS. Now in Rails 3 everything is displayed in UTC. Is it possible to get back that default viewing behaviour without having to put in some js hack to detect the user's timezone? Thanks! Chris 回答1: I found that if you add localtime to your string you get the proper date time... Invoice.last.created_at.localtime 回答2: A simple

Incomplete list of timezones generated by PHP

别来无恙 提交于 2019-12-10 19:32:32
问题 I've tried generating the complete set of timezones as specified in http://php.net/manual/en/timezones.php (except UTC) by using the following code: $zones = timezone_identifiers_list(); print_r($zones); But this list seems to skip ~ 50 regions, eg: Pacific/Samoa (as compared to http://php.net/manual/en/timezones.php) What are we doing wrong? phpinfo() shows: PHP Version 5.3.4 Apache Version Apache/2.2.3 (CentOS) $ uname -r 2.6.18-028stab070.14 Edit #2 date date/time support enabled "Olson"

new java.sql.Date(0) not corresponding to 00:00:00 1 January 1970

梦想的初衷 提交于 2019-12-10 19:29:50
问题 The code below: import java.sql.Date; import java.text.DateFormat; import java.text.SimpleDateFormat; public class FooMain { private static final DateFormat DF = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm'Z'"); public static void main(String args[]) { System.out.println(DF.format(new Date(0))); } } prints out: 1970-01-01T01:00Z Should'nt it have been 1970-01-01T00:00Z instead? I understand that Unix Epoch time is always unambiguous and we don't have to worry about timezones, but here's my

Dygraph showing dates in an arbitrary Timezone

夙愿已清 提交于 2019-12-10 19:24:51
问题 I needed to get Dygraph to respect arbitrary timezones. All dates shown in/on/around the graph should be able to be shown in an arbitrary timezone. The problem: Javascript does not support timezones other than the browser local timezone. There are libraries out there (timezone-js, moment-js with moment-timezone-js) to address this, but Dygraph doesn't know about them. 回答1: UPDATED answer, now works with Dygraph version 1.1.1. For old answer skip past horizontal rule. There is now an easier

rails' utc_to_local and daylight savings time

这一生的挚爱 提交于 2019-12-10 19:16:20
问题 > e = Event.first > e.registration_start_utc #registration_start_utc is a datetime column => Sat, 23 Oct 2010 06:38:00 UTC +00:00 > e.registration_start_utc.utc? => true > ActiveSupport::TimeZone.find_tzinfo("America/New_York").utc_to_local(e.registration_start_utc) => Sat, 23 Oct 2010 02:38:00 UTC +00:00 2 questions about this: 1) Why is that last output showing "UTC" -- the hour got converted (6 => 2) but it still says UTC. Why not EST/EDT? 2) What happens after daylight savings time

Set JS global time zone

大兔子大兔子 提交于 2019-12-10 19:07:56
问题 Is there anyway to set the global/default timezone in JS on the browsers side? E.g. if I have some date that are +1300 and the user is -0800 it converts the times. But I always want to show the times as +1300 . My application is already very large so I'm hoping I can just set it in one place, otherwise it will involve going though hundreds of lines of code to adjust anywhere a date is used. 回答1: No. There is only one global timezone: UTC - unfortunately it's not the default in JS, you have to

mapping location to a time zone

别说谁变了你拦得住时间么 提交于 2019-12-10 19:02:05
问题 I need to get the time zone for a given address/location. Assume that the address/location can be reverse geocoded (using google) to a lat/lng if necessary. This means that I may not have a zip code. I was really hoping that google provided some kind of API for this, but it seems that they don't. At a minimum you can google search for "time in washington, dc" and get the time/TZ -- but then I'd have to screen scrape that which is not fun :( I know there are databases available that map

Trying to parse a datetime in PDT to a ZonedDateTime representation

那年仲夏 提交于 2019-12-10 18:55:09
问题 How should I parse this datetime value that is in the PDT timezone? 06/24/2017 07:00 AM (PDT) I want to maintain the timezone so that I can then represent the time in other timezones depending on the website visitors preferences. I tried using ZonedDateTime but I get a parse error: java.time.ZonedDateTime.parse("06/24/2017 07:00 AM (PDT)") The error is: java.time.format.DateTimeParseException: Text '06/24/2017 07:00 AM (PDT)' could not be parsed at index 0 at java.time.format

How to add/subtract TimeZone Offset to a Timestamp in Java?

对着背影说爱祢 提交于 2019-12-10 18:53:33
问题 I am using JDK 8 and I played with ZonedDateTime and Timestamp a lot. But still I am not able to get a solution for the problem I am facing. Lets say I get a formatted Timestamp in GMT (UTC) and my server is located somewhere. Lets say it's set to Asia/Calcutta TimeZone (whose ZoneOffset is +05:30 ). How to basically add/subtract my time zone offset to the Timestamp? Input : 2017-09-13 13:10:30.333 Output: 2017-09-13 18:40:30.333 Explanation : In the input, the timezone offset which is 5hrs