timezone

Getting current time with timezone in python?

白昼怎懂夜的黑 提交于 2019-12-23 13:39:07
问题 I'm using Google App Engine with python. And I can't install third party library. I though this should work, but it actually runs without error but it returns current time timezone is not applied. What did I do wrong? from datetime import tzinfo, timedelta, datetime class Seoul_tzinfo(tzinfo): def utcoffset(self, dt): return timedelta(hours=9) def dst(self, dt): return timedelta(0) greeting.date = datetime.now( Seoul_tzinfo() ) 回答1: Are you talking about when the entity is fetched from the

Java SimpleDateFormat timezone parsing

蓝咒 提交于 2019-12-23 13:29:54
问题 I'm curious how Java's SimpleDateFormat decides when to increment/decrement the passed in time based on the timezone it's set to. Let's say I have a date 06/04/2013. I then set the timezone to one far away from me(I'm in GMT-5). Let's say I use GMT+8. I call SimpleDateFormat df = new SimpleDateFormat( "M/d/yy" ); df.setTimeZone( TimeZone.getTimeZone( "GMT+8" ) ); df.parse( endDate ) // this returns 06/**03**/2013 //endDate is just a String It returns 06/03/2013. Why does it decrement it? Edit

Java SimpleDateFormat timezone parsing

喜欢而已 提交于 2019-12-23 13:29:28
问题 I'm curious how Java's SimpleDateFormat decides when to increment/decrement the passed in time based on the timezone it's set to. Let's say I have a date 06/04/2013. I then set the timezone to one far away from me(I'm in GMT-5). Let's say I use GMT+8. I call SimpleDateFormat df = new SimpleDateFormat( "M/d/yy" ); df.setTimeZone( TimeZone.getTimeZone( "GMT+8" ) ); df.parse( endDate ) // this returns 06/**03**/2013 //endDate is just a String It returns 06/03/2013. Why does it decrement it? Edit

In Postgresql, how to un-invert the timezone offsets with “At Time Zone”

久未见 提交于 2019-12-23 13:07:56
问题 I'm trying to wrap my head around Postgresql timezones, and I can't seem to figure this out. EST is "Eastern Standard Time" in America, and is typically UTC-5. Example 1: Base Test select '08/31/2011 12:00 pm EST'::timestamptz at time zone 'EST'; timezone --------------------- 2011-08-31 12:00:00 Example 2: Offset is +5 select '08/31/2011 12:00 pm EST' at time zone '+5'; timezone --------------------- 2011-08-31 12:00:00 Example 3: Offset is -5 select '08/31/2011 12:00 pm EST' at time zone '

How to display local time with PHP

本小妞迷上赌 提交于 2019-12-23 13:06:28
问题 Our server is set to GMT time so the hour does not keep jumping around in spring and autumn. However, during summer time, it is annoying that all the times are displayed an hour out. How do I get and display the time, taking into account the local timezone in PHP (especially when the server thinks the local timezone is GMT). or, How do I know if an area is using "summer time" at the moment? or, How do I display a GMT time stamp or a different timezone? 回答1: Actually, I think I may have found

Remove timezone during POSIXlt Conversion in R

牧云@^-^@ 提交于 2019-12-23 12:52:42
问题 I have a column in my dataframe as datetime (factor) with the values as "15-10-2017 16:41:00". I wanted this data to be converted as "2017-10-15 16:41:00". When i try to convert this, I'm getting the timezone also as output. I tried using tz="", usetz=F but no use. Any suggestions ? Code: as.POSIXlt("15-10-2017 16:41:00",format = "%d-%m-%Y %H:%M:%S") [1] "2017-10-15 16:41:00 IST" 回答1: From the help page of as.POSIXlt : "" is the current time zone which is the default. That's why it does not

PHP ini date.timezone? Server or client location time zone?

这一生的挚爱 提交于 2019-12-23 12:05:53
问题 I know this might sound a silly question, but I did not find in PHP documentation somewhere were they state loud and clear this one. I have got a web application. Users of my web appliations are in Europe , but the server running the web appliation is in US . How should I set the date.timezone php ini directive??? I suppose to where the server is located so if it's in New York: date.timezone = "America/New_York" But am I right? 回答1: I think that it's better to set server's local timezone or

How to convert string offset to timespan in c#

蓝咒 提交于 2019-12-23 10:18:23
问题 I'm trying to convert the convert time to the user's time zone, but I don't have the windows time zone string such as "Pacific Standard Time". All I have is a string offset such as "-07:00". Looks like I need to create a timespan. Is the only way to parse this string manually?. Seems like there should be a way to convert a time using a string offset, but maybe I am missing something. I have this but it requires the timezone. I'm trying to modify it to use the offset instead, but you can see

How do I set default timezone in cakephp?

余生颓废 提交于 2019-12-23 09:41:17
问题 So I have a system that is mostly finished, just ironing out some final bugs. We have an issue that the program seems to be permanently set in the New York timezone. I have this line of code in both core.php and bootstrap.php: date_default_timezone_set("Australia/Melbourne"); But the system keeps reporting that it is in America/NewYork. Can anyone help me set the timezone to Australia Melbourne? 回答1: In the config/core.php file of the app folder try the following with single quotes: date

MariaDB set timezone in config

▼魔方 西西 提交于 2019-12-23 09:36:32
问题 How do I set the server timezone in the MariaDB configuration? The only thing I can find in the documentation is using command-line flags, which I don't want to do. default_time_zone , which works on vanilla MySQL, isn't recognized by MariaDB. 回答1: It is default-time-zone ( - instead of _ ): [server] default-time-zone=UTC 回答2: Pasi had the right idea. 'UTC' didn't work but '+00:00' did. 来源: https://stackoverflow.com/questions/26349714/mariadb-set-timezone-in-config