timezone

Hibernate Timestamp with Timezone

帅比萌擦擦* 提交于 2019-12-17 19:48:12
问题 I'm new to Hibernate and am working with an Oracle 10g database. We have columns in our tables that are of type TIMESTAMP WITH TIMEZONE . Hibernate does not seem to support this mapping directly. Is there a standard way to go about this? 回答1: An example of a UserType storing java.util.Calendar with time zone information is given in this blog post: http://www.joobik.com/2010/12/mapping-dates-and-time-zones-with.html 回答2: TIMESTAMP WITH TIMEZONE is Oracle extension and thus is not supported by

How can I get a human-readable timezone name in Python?

删除回忆录丶 提交于 2019-12-17 19:34:33
问题 In a Python project I'm working on, I'd like to be able to get a "human-readable" timezone name of the form America/New_York , corresponding to the system local timezone, to display to the user. Every piece of code I've seen that accesses timezone information only returns either a numeric offset (-0400) or a letter code (EDT) or sometimes both. Is there some Python library that can access this information, or if not that, convert the offset/letter code into a human-readable name? If there's

Date TimeZone conversion in java?

北战南征 提交于 2019-12-17 19:25:36
问题 I was looking for the simplest way to convert a date an time from GMT to my local time. Of course, having the proper DST dates considered and as standard as possible. The most straight forward code I could come up with was: SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); String inpt = "2011-23-03 16:40:44"; Date inptdate = null; try { inptdate = sdf.parse(inpt); } catch (ParseException e) {e.printStackTrace();} Calendar tgmt = new GregorianCalendar(TimeZone.getTimeZone(

MySQL: keep server timezone or user timezone?

浪子不回头ぞ 提交于 2019-12-17 18:56:41
问题 I'm thinking about to store dates on user login in my site, but I don't know what is the most logical solution. Initially, I though to use server timezone, and then to manage it using difference operations between server machine date and user machine date, but I've also considered to change it direclty using timezone and php class date, so: <?php // my server has for example America/New_York timezone $user_timezone = "Europe/Rome"; date_default_timezone_set ($user_timezone); $date = date ('Y

How to get the common name for a pytz timezone eg. EST/EDT for America/New_York

99封情书 提交于 2019-12-17 18:49:02
问题 Given a pytz timezone for a particular user(calculated from his offset), i want to display the common name for that timezone. I'm assuming people are more accustomed to seeing EST or PST instead of spelled out like America/NewYork . Does pytz give me those standard names somewhere, or will i have to manually do this via a table? This could potentially get messy, since for example places are EST in a season and shift to showing EDT during others. 回答1: Given a pytz timezone for a particular

How do I make MySQL's NOW() and CURDATE() functions use UTC?

无人久伴 提交于 2019-12-17 18:13:09
问题 I want to make it so calls to NOW() and CURDATE() in MySQL queries return the date in UTC. How do I make this happen without going through and changing all queries that use these functions? 回答1: Finally found what I was looking for... In my.cnf, [mysqld_safe] timezone = UTC I was putting this option under [mysqld], and mysql was failing to start. Calling "SET time_zone='+0:00';" on every page load would also work, but I don't like the idea of calling that query on every single page load. 回答2:

How to get the current time zone?

淺唱寂寞╮ 提交于 2019-12-17 16:31:57
问题 In most of the examples I had seen: time_zone_ptr zone( new posix_time_zone("MST-07") ); But I just want to get the current time zone for the machine that runs the code. I do not want to hard code the time zone name. 回答1: Plain posix: call tzset, use tzname. #include <ctime> tzset(); time_zone_ptr zone(new posix_time_zone(tzname[localtime(0)->tm_isdst])); Posix with glibc/bsd additions: time_zone_ptr zone(new posix_time_zone(localtime(0)->tm_zone)); The above are abbreviated Posix timezones,

Get user timezone string with Javascript / PHP?

…衆ロ難τιáo~ 提交于 2019-12-17 16:31:11
问题 I'm trying to get the user's timezone as a string on singup. example: $timezone = "Asia/Tel_Aviv"; While researching the issue, I got how to Get timezone offset with Javascript, but I'm still unclear about how can I translate the timezone offset to a timezone string in php, as shown above? Or, which other method cas I use in Javascript / PHP for getting the timezone string for each user? I'm really not sure how to approach this. 回答1: You can't do this in PHP alone. You can use Javascript to

unknown timezone name in R strptime/as.POSIXct

雨燕双飞 提交于 2019-12-17 16:30:18
问题 Where can I find a list of all legal time names for R function as.POSIXct ? as.POSIXct("1970-01-01",tz="CST") generates a warning that "CST" (Central Standard Time) is unknown. 回答1: ?Sys.timezone has some hints, specifically to look in: "R_HOME/share/zoneinfo/zone.tab" ( R_HOME is the directory R is installed in). Keep in mind that time zones are nasty and many of their nuances are operating system (and locale?) specific. In your specific case, you want "CST6CDT" instead of "CST" . 回答2:

Cannot Set date.timezone In php.ini file

无人久伴 提交于 2019-12-17 16:18:45
问题 I'm using php5.5 and getting this error whenever I used the date function in PHP: Warning: phpinfo(): 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 most likely misspelled the timezone identifier. We selected the timezone 'UTC' for now, but please set date.timezone to select your timezone. in /var/www/info