utc

uint64 UTC time

I have a UTC date time without the formatting stored in a uint64, ie: 20090520145024798 I need to get the hours, minutes, seconds and milliseconds out of this time. I can do this very easily by converting it to a string and using substring. However, this code needs to be very fast so I would like to avoid string manipulations. Is there ...

How to render local time given UTC datetime values in ASP.Net without using Javascript?

Is it possible to display local times to users without using Javascript when you store the values as UTC? ...

Why does DateTime.Now.ToString("u") not work?

I currently in British summer time which is UTC +1 Hour. I confirmed my PC is correct with the following code and it returns true. System.TimeZone.CurrentTimeZone.IsDaylightSavingTime(Date.Now) My question is then why does the UTC formatter not work as I would expect: DateTime.Now.ToString("u") It returns the exact current system d...

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

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? Believe, me, I have been Googling for the answer, but in 20 minutes, I have found nothing that has worked. ...

How do you convert a JavaScript date to UTC?

Suppose a user of your website enters a date range. 2009-1-1 to 2009-1-3 You need to send this date to a server for some processing, but the server expects all dates and times to be in UTC. Now suppose the user is in Alaska or Hawaii or Fiji. Since they are in a timezone quite different from UTC, the date range needs to be converted...

Which php date and time tools to use for GMT offsetting

It appears there are many ways to approach date and time massaging in php. I usually am only every dealing with local time. Today, I need to work in UTC. I am querying against an API, the data they give me about an arbitrary record is: created: Thu, 18 Jun 2009 21:44:49 +0000 * Documented as 'UTC record creation time' utc_offset: -28...

MySQL and international dates

Say I have multiple servers in multiple locations and I want to use MySQL's datetime type for the field date and I always want to have the field date have the UTC timestamp so I would execute a UTC_TIMESTAMP() when I add it to the database. Now say I want to have MySQL output the UNIX TIMESTAMP for it. When I do this on Server A I get t...

Weird created_at behavior

I've set config.time_zone = 'UTC' in environment.rb, and yet still I get some weird behavior with Rails' built-in datetime fields: >> Time.now => Sun Jun 21 17:05:59 -0700 2009 >> Feedback.create(:body => "testing") => #<Feedback id: 23, body: "testing", email_address: nil, name: nil, created_at: "2009-06-22 00:06:09", updated_at: "2009...

Does SQL Server 2005 Automatically Convert Time Fields to UTC? Does ADO.Net?

I'm using Visual Studio 2008. I'm using an .xsd/tableadapters to access a SQL Server 2005 database. One of my tables has a DateTime field. When a record is inserted into the table, the time is automatically converted to the UTC time, which is fine. I just want to know where that takes place. Does SQL Server do the conversion or is .Net d...

Python Unix time doesn't work in Javascript

In Python, using calendar.timegm(), I get a 10 digit result for a unix timestamp. When I put this into Javscript's setTime() function, it comes up with a date in 1970. It evidently needs a unix timestamp that is 13 digits long. How can this happen? Are they both counting from the same date? How can I use the same unix timestamp between...

how to render a user the local-time using a UTC Time (asp.net & ajax)

Hi, I've an issue while my data persisted as utc date-time and I want my users see the right time (thier) local time. I can do this using javascript that sends the local time from the client machine to server, but this will cause me the first time the page will be seen it will be written using the UTC-Time. do you have more ways? than...

Is there ever a good reason to store time not in UTC?

I am wondering if there are any good reasons to ever store time information in anything other that UTC (GMT)? I believe that this is a solid rule for all software engineering. The conversion to local time is merely a translation that happens at the UI layer for display purposes. I have also seen cases where the translatation is needed in...

expiry date using utc timestamp, mysql and php?

How do you add time or days to a current utc_timestamp? I am using; new CDbExpression('UTC_TIMESTAMP()') for both 'created' and 'updated' fields in my mysql table but would like to add an 'expiry' field which would allow 4 days from creation date. I presume this is possible but am unsure how. Thanks ...

How do you create a UTC time in C for a specific day, month and year ?

How do I create a UTC time in C for the following date: 1st July 2038 using standard ANSI C function calls (given that the tm_year element of the tm structure cannot be greater than 137) ? ...

How to get UTC value for SYSDATE on Oracle

Hello, Probably a classic... Would you know a easy trick to retrieve an UTC value of SYSDATE on Oracle (best would be getting something working on the 8th version as well). For now I've custom function :( Cheers, Stefan ...

How does DateTime.ToUniversalTime() work?

How does the convertion to UTC from the standard DateTime format work? More specifically: if I create a DateTime object in one time zone and then switch to another time zone and run ToUniversalTime() on it, how does it know the conversion was done correctly and that the time is still accurately represented? Thanks ...

TSQL: How to convert local time to UTC? (SQLServer2008)

We are dealing with an application that needs to handle global time data from different time zones and daylight savings time settings. The idea is to store everything in UTC format internally and only convert back and forth for the localized user interfaces. Does the SQL Server offer any mechanisms for dealing with the translations given...

Axapta/DynamicsAx: UTC datetime conversion

We are trying to interpret the data stored in Axapata's TIMEZONESRULESDATA table. Particularly, we'd like to figure out how it stores DST begin/end times. So far, my guess is: TZENUM: foreign key referencing TIMEZONESLIST (time zone name and identifier) YEAR: 0 if rule is valid indefinitely or a year where the timezone rule is in effect...

Converting old and new local times to UTC under Windows XP/Server 2003

My application converts past and present dates from local time to UTC. I need to ensure I will honor any future DST updates to Windows while still correctly handling past dates. The application is written in C++ and is running on Server 2003. Options I've researched: gmtime() and localtime() are not always correct for past dates bec...

Nil NSDate when trying to get date from UTC string in zulu time

Writing an iPhone app in Objective-C, I have a date in string form (in UTC format, with a Z on the end to denote zero UTC offset, or zulu time), which I need to parse into an NSDate object. A bit of code: NSDateFormatter* df = [[NSDateFormatter alloc]init]; [df setDateFormat:@"yyyy-MM-dd'T'HH:mm:ss.SSSZ"]; NSString* str = @"2009-08-11T06...