timezone

Set default timezone in Yii

梦想的初衷 提交于 2019-12-12 12:15:38
问题 I am using following config for timezone in config.php 'timeZone' => 'UTC', It is working fine and all dates are stored in database according to UTC . Now each user has its own timezone in his/her profile like UTC+5 , UTC-5 , UTC+0 , etc. Now how can I show dates in reports according to user timezone. I used active record to fetch records from database. Is there any general way for all queries or we have to convert date to user timezone each time manually in php ?? Thanks. 回答1: You can set

Why does momentjs isDST() return wrong time when zone() is used

和自甴很熟 提交于 2019-12-12 12:13:28
问题 I'm trying to check for isDST() (returns true or false if daylight saving time is active). It works fine if I use the current date time- for example var isdst = moment().isDST() returns true for my timezone. However, what I want to do is first set the timezone offset and then check to see if daylight saving time is active in that timezone. I have the following code below. var isdst = moment('2014-03-28').zone('+01:00'); console.log('daylight savings for +0100 is ' + isdst); //returns true

Is it possible to specify time zone for DB data source in PHPStorm?

徘徊边缘 提交于 2019-12-12 11:34:56
问题 I have UTC time zone set in my PostgreSQL and SELECT NOW() shows me the right date in psql console. I use PHPStorm for development and its database console for accessing my database, but it uses different time zone (Europe/Moscow, which is the time zone of my Mac), and SELECT NOW() shows me the time in this time zone (and by the way, the date is wrong, because the Europe/Moscow time zone recently changed its offset to +3 from +4 ). I have not found any information on how to tell PHPStorm to

Momentjs timezone - getting date at time in specific timezone

允我心安 提交于 2019-12-12 11:34:44
问题 I am attempting to create a date from a UTC base in a user's specific timezone, in this case "America/Los Angeles" using momentjs/momentjs timezone. However, I'm not getting the results I expect: var tempDate = moment(1448841600000); //moment("2015-11-30"); //monday 11/30 in UTC var adjustedStart = moment.tz(tempDate, "America/Los_Angeles"); adjustedStart.hour(9); adjustedStart.minute(30); console.log("adjustedStart in milliseconds:" + adjustedStart.valueOf()); The console output is

Windows Time Zone Abbreviations in ASP.NET

馋奶兔 提交于 2019-12-12 11:21:36
问题 Do they even exist? I am really sick of having to display "Romance Standard Time" to my European users and trying to explain why their "Central European Time" can't be displayed as "CET". If I parsed "Romance Standard Time" and presented them with "RST" that would be meaningless to them, or possibly confused as "Russian Standard Time" or other nonsense. Is there not a way to get generally accepted abbreviations out of Windows? I need something that works across North America, South America,

How to get timezone by IP [duplicate]

荒凉一梦 提交于 2019-12-12 11:17:31
问题 This question already has answers here : How to find timezone ID from IP address/country name in PHP? (4 answers) Closed 5 years ago . I have a registration by which i can get the IP address of user who registers. I want to get the timezone of user by his IP address. Like in jquery we can get like this Timezone in jquery How can i do it in PHP. 回答1: You can use GeoIP based services http://www.php.net/manual/en/book.geoip.php Or You can use online services that gives timezone of the IP that

as.POSIXct rejects +1300 timezone

喜夏-厌秋 提交于 2019-12-12 10:59:13
问题 I'm using as.POSIXct to parse times with timezones, like this: as.POSIXct("2009-01-05 14:19 +1200", format="%Y-%m-%d %H:%M %z") However, if the string includes the timezone information +1300 , the function returns NA : > as.POSIXct("2009-01-05 14:19 +1300", format="%Y-%m-%d %H:%M %z") [1] NA Aparently +1300 is a valid timezone (NZDT – New Zealand Daylight Time). How to convince R to parse it? 回答1: This was a bug in 3.0.2 release, which was fixed in R-3.1.0 Patched build. 来源: https:/

How to manage timezones in a web application?

寵の児 提交于 2019-12-12 10:57:23
问题 I wan't to manage the different timezones of my users in my web application, but I have no idea where to start. I have to save the local time of each user in my database?, or maybe make the conversion to a UTC time, save it, and then make the conversion again to show it?, or there is another way? For example, if one of my users make an appointment in his local time, I have to convert it to UTC store it in my database, and then when he need it, convert it again to his local time an show it??

Correctly parse date string with timezone information

房东的猫 提交于 2019-12-12 10:55:36
问题 I'm receiving a formatted date string like this via the pivotal tracker API: "2012/06/05 17:42:29 CEST" I want to convert this string to a UTC datetime object, it looks like python-dateutil does not recognize that timezone, pytz doesn't know it either. I fear my best bet is to replace CEST in the string with CET, but this feels very wrong. Is there any other way to parse summer time strings to UTC datetime objects I couldn't find? pytz.timezone('CEST') # -> pytz.exceptions

Converting from java.util.TimeZone to org.joda.DateTimeZone

拈花ヽ惹草 提交于 2019-12-12 10:54:18
问题 How is it possible in Java to convert an instance of java.util.TimeZone to org.joda.DateTimeZone and keeping the daylight saving time? 回答1: Joda-Time in maintenance-mode The Joda-Time project, now in maintenance mode, advises migration to the java.time classes. java.time.ZoneId The modern replacement for java.util.TimeZone is java.time.ZoneId & java.time.ZoneOffset. You should avoid the old legacy date-time classes. But if necessary, you can convert to/from the java.time types. Look to new