timezone

How can I get the local server's time zone?

∥☆過路亽.° 提交于 2019-12-18 14:54:00
问题 How can I get the local server's timezone without relying on php.ini or other configuration files? I am looking for an output similar to the output of date('e'). eg. "UTC", "GMT", or "Atlantic/Azores". I need to know this so that I may know the MySQL timezone. 回答1: If you're using a Linux/Unix based hosting platform, you could use the output of the date command with the "alphabetic time zone abbreviation" formatter as such: $systemTimeZone = system('date +%Z'); However, it should be noted

How to use NSTimeZone -timeZoneWithName: with a city name from Rails ActiveSupport?

依然范特西╮ 提交于 2019-12-18 14:14:53
问题 If I only have the city name like Bangkok or Tokyo , how can I supply a timezone parameter in [NSTimeZone timeZoneWithName:@"Asia/Tokyo"] where it also has continent and slash in front of city? I already tried [NSTimeZone timeZoneWithName:@"Tokyo"] , it doesn't work. 回答1: Thanks for the answers guys, but it looks like those city names are just a format that Rails "ActiveSupport::TimeZone" uses. So I just have to map it back. The mapping is here -> http://api.rubyonrails.org/classes

Sending a date and timezone from GAE server to GWT client

寵の児 提交于 2019-12-18 13:36:41
问题 OK folks, I have been going around this problem for about 2 weeks now trying everything I can think of and looking at tons of answers on here that feel like they are going to answer it, but I just cant work out how I am meant to do what I am trying to do and it is driving me absolutely NUTS! No one seems to have an answer anywhere, there are half answers all over the place, but none seem to actually do what I need it to do, surely SOMEONE has solved this problem before! Please excuse the

Converting between timezones in C

久未见 提交于 2019-12-18 13:28:49
问题 I need to convert time between timezones in C (on linux, so anything specific would do too). I know my current time, local and UTC, I have the offset of the target time. I am trying to use mktime, gmtime, localtime and similar set of functions but still can't figure it out. Thanks in advance. 回答1: As comments do not allow posting the code, posting as a separate answer.. If you know "local" time and "UTC" time, you can calculate the offset of the "other" time from your "local" time. Then you

Get Daylight Saving Transition Dates For Time Zones in C

十年热恋 提交于 2019-12-18 13:17:17
问题 In C, is there a simple, cross-platform way of retrieving the dates that a given timezone begins and ends daylight saving? I already have timezone offset information and whether or not daylight savings is currently being observed, but I really need the dates at which daylight savings begins and ends (for an external dependency I don't control). In Windows, I'm using GetTimeZoneInformation to get TimeZoneInfo, but I can't find a similar function for Linux/Solaris/Mac. I should point out also

`[Exception] DateTime::__construct(): `It is not safe to rely on the system's timezone settings [duplicate]

痞子三分冷 提交于 2019-12-18 12:54:09
问题 This question already has answers here : PHP Configuration: It is not safe to rely on the system's timezone settings [duplicate] (12 answers) Closed 6 years ago . I 'm using codeception (bdd) making test but gives error [Exception] DateTime::__construct(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you

How do I get Ruby to parse time as if it were in a different time zone?

孤人 提交于 2019-12-18 12:49:05
问题 I'm parsing something like this: 11/23/10 23:29:57 which has no time zone associated with it, but I know it's in the UTC time zone (while I'm not). How can I get Ruby to parse this as if it were in the UTC timezone? 回答1: You could just append the UTC timezone name to the string before parsing it: require 'time' s = "11/23/10 23:29:57" Time.parse(s) # => Tue Nov 23 23:29:57 -0800 2010 s += " UTC" Time.parse(s) # => Tue Nov 23 23:29:57 UTC 2010 回答2: If your using rails you can use the

What timezone is Heroku server using?

青春壹個敷衍的年華 提交于 2019-12-18 12:48:01
问题 What timezone does Heroku's servers use? I'm trying to use node-cron and have the timezones line up, but I can't understand what timezone Heroku is using. Here's an example. 2015-11-30T09:16:45.874086+00:00 回答1: By default Heroku will return calls for current time in UTC. You can manually set your app's timezone by adding a TZ environment variable via the config command. Keep in mind that you must use the tz database time zone format. For example, if you wanted to set your default timezone to

Local time zone offset in PostgreSQL

懵懂的女人 提交于 2019-12-18 12:45:35
问题 My web app stores all timestamps in UTC without time zones. I have a shell/psql script that returns a list of recent logins, and I want that script to display login times in the server's local time zone (which may vary depending on where the server is and with daylight savings). To get an interval representing the difference between my database server's time zone and UTC, I'm currently using this hack: SELECT age(now() at time zone 'UTC', now()); That works, but is there a more

Hibernate force timestamp to persist/load as UTC [duplicate]

◇◆丶佛笑我妖孽 提交于 2019-12-18 12:15:00
问题 This question already has answers here : How to store date/time and timestamps in UTC time zone with JPA and Hibernate (11 answers) Closed 4 years ago . I'm using java, mysql, hibernate (3.6.x). On the java side I'm using java.sql.Timestamp objects. On the mysql side I'm using datetime columns. I want hibernate to save/load these Timestamp objects using UTC time zone regardless of system/java/mysql time zone. I found " How to store date/time and timestamps in UTC time zone with JPA and