timezone

JavaScript date-only format guaranteed to be interpreted as local time in modern browsers

北城以北 提交于 2019-12-24 13:48:06
问题 I am looking for a date format (only year, month and day, no time component), that will be guaranteed to be interpreted as local time, in all reasonably modern browsers, when passed to the Date() constructor in JavaScript. The (3-letter English month abbreviation) (2-digit date) (4-digit year) format seems to work. When I do new Date('Apr 01 2015') on my English system, in Chrome, with my machine being in the Eastern timezone, I get back Wed Apr 01 2015 00:00:00 GMT-0400 (Eastern Daylight

Date comparison or timezone not set properly

为君一笑 提交于 2019-12-24 12:46:08
问题 I'm trying to do a simple comparison of dates with the intent of moving to another array index based on the day. Though vastly more efficient than the code I was using, the following (Unable to parse a date) doesn't preserve the timezone offset: let noaaDate = "2014-08-22T15:00:00-04:00" let format="yyyy-MM-dd'T'HH:mm:ssZ" var dateFmt = NSDateFormatter() dateFmt.dateFormat = format let newreadableDate = dateFmt.dateFromString(noaaDate) println(newreadableDate) Output: Optional(2014-08-22 19

Ruby on Rails: Why do I get timezones munged when I write a time to the DB, then read it back?

℡╲_俬逩灬. 提交于 2019-12-24 12:24:17
问题 I have config.time_zone in environment.rb set to "UTC", and my mySQL server returns the current time in my local time zone when I issue "select now();" and in utc when I ask for "select utc_timestamp;" I'm running rails 2.1.2, the mysql gem 2.7.3, activerecord gem 2.1.2, and mysql --version returns "Ver 14.12 Distrib 5.0.27 for Win32 (ia32)". EDIT: My environment.rb is set to UTC and had been since I started the project. A server restart would have picked up no changes. record = Record.find(

getdate.y grammar doubts

落爺英雄遲暮 提交于 2019-12-24 11:37:00
问题 http://www.freebsd.org/cgi/cvsweb.cgi/~checkout~/src/usr.bin/tar/Attic/getdate.y?rev=1.9.12.1;content-type=text%2Fplain;hideattic=0 I am trying to understand how yyTimezone is calculated in code below: | bare_time '+' tUNUMBER { /* "7:14+0700" */ yyDSTmode = DSToff; yyTimezone = - ($3 % 100 + ($3 / 100) * 60); } | bare_time '-' tUNUMBER { /* "19:14:12-0530" */ yyDSTmode = DSToff; yyTimezone = + ($3 % 100 + ($3 / 100) * 60); } How I understand is, lets say the timestamp is 2011-01-02T10:15:20

Timezone specific “Open Now” function

一曲冷凌霜 提交于 2019-12-24 11:28:08
问题 I need an 'is open now' php function on a site I am building. Looking at a previous question, I have built my mysql table: hours_id INT NOT NULL, loc_id INT NOT NULL, dow TINYINT NOT NULL, open_time TIME NOT NULL, close_time TIME NOT NULL, Then using: "SELECT open_time, close_time FROM opening_hours WHERE dow=dayofweek(curdate()) AND loc_id=:loc_id" I can then work out if it is open or not. The product I am building is global and I will need the 'open now' to be related to the timezone the

MySQL: How to select the UTC offset and DST for all timezones?

核能气质少年 提交于 2019-12-24 10:58:15
问题 I want a list of all timezones in the mysql timezone tables, and need to select: 1) Their current offset from GMT 2) Whether DST is used by that timezone (not whether it's currently in use, just whether DST is considered at some point in the year for that timezone) Reason: I need to build a web form and match the users time zone information (which I can generate from javascript) to the correct time zone stored in the mysql DB. I can find UTC offset and get a DST flag from javascript functions

How to show a Unix-time in a local time format

丶灬走出姿态 提交于 2019-12-24 10:56:36
问题 I have a php variable say $expTime (which has a unixtime say-1359683953) . I want to display this variable on the client side(in a proper time format according to his local time) . I am so confused between the UTC ,GMT , DST all that things. Can anyone suggest a solution for this using php or javascript please. when I am using echo date('h:i M d/y',$expTime) it is showing me a wrong time. How I am saving the time to database: var exp_day= parseInt($("#exp_day").val()); var exp_hrs= parseInt($

Best method for PHP Timezones

浪尽此生 提交于 2019-12-24 10:49:42
问题 Question 1) Assuming a user has a timezone setting saved as 'America/New_York' in my application, would I just use this on a page where I need to show the correct time with timezone offset and daylight savings applied <?php $time_zone = 'America/New_York'; date_default_timezone_set($time_zone); echo date('D,F j, Y, h:i:s A'); ?> OR should I use something more like this approach When I query my data I use the following PHP script <?PHP while($row = mysql_fetch_array($registration)){ $dt_obj =

Is it possible to specify the time zone on Windows Azure?

て烟熏妆下的殇ゞ 提交于 2019-12-24 09:59:11
问题 I am going to migrating a system to Windows Azure. And it will used UTC time for all existing function. Is there any way to set the time zone globally? Or I need to change all the code which display the time? My application will mainly serve in a specified timezone. I have try apply the culture and uiculture on web.config. And it does not work. Thanks. 回答1: As per the Windows Azure Team Blog - all the timing calculations/display etc have been moved to UTC.. https://azure.microsoft.com/en-us

Timezone calculation

北慕城南 提交于 2019-12-24 07:45:59
问题 How to find out the current time in different timezone in xcode for an iphone application? Suppose i'm in India and i want to know the current time in USA how do i get the time then. Thanks in advance Joy 回答1: See Introduction to Date and Time Programming Guide for Cocoa. There are built-in methods for handling timezones. 来源: https://stackoverflow.com/questions/2552134/timezone-calculation