utc

Display local time from utc time stored in sql database on asp.net app

I've got times saved in a sql database in utc format. I'm displaying those times on a gridview, however they are still UTC format. I'd like to convert them to the client's browsers local time. The problem is that although I can get the timezone offset that is only for the current date/time. That offset could change if some of those d...

How to force QDateTime::fromString to read UTC time.

I have some input containing UTC time formatted according to iso8601. I try to parse it using QDateTime: const char* s = "2009-11-05T03:54:00"; d.setTimeSpec(Qt::UTC); d = QDateTime::fromString(s, Qt::ISODate); Qt::TimeSpec ts = d.timeSpec(); When this fragment ends, ts is set to localTime and d contains 3 hours 54 minutes. Do...

How can SELECT UTC_TIMESTAMP() return -10:00 UTC???

Either I'm being stupid or something's wrong here. I have two SQL Servers, the one is on my local machine (local time +2 GMT) and the other is somewhere else (NOW() seems to return +8 GMT)and I access it through phpMyAdmin. I have a table that has a DATETIME column. I'm -trying- to store the current GMT/UTC time and then display it agai...

Difference between UTC and GMT Standard Time in .NET

In .NET, the following statements return different values: Response.Write( TimeZoneInfo.ConvertTime( DateTime.Parse("2010-07-01 5:30:00.000"), TimeZoneInfo.FindSystemTimeZoneById("Pacific Standard Time"), TimeZoneInfo.FindSystemTimeZoneById("GMT Standard Time")) ); // displays 7/1/2010 1:30:00 PM ..and this... Respons...

How to make date.getTime() returns UTC time?

I have a Date object which represents a UTC time. When I use the method getTime() to get the long value of this object, the value returned corresponds to our local time (central US). What is the correct way to get the value back which corresponds to the original UTC time? Thanks ...

MySQL UTC Date format

I am pulling data from Twitter's API and the return date is UTC in the following form: Sat Jan 24 22:14:29 +0000 2009 Can MySQL handle this format specifically or do I need to transform it? I am pulling the data using Python. ...

How do I parse a UTC date format string to local date time?

I'm currently using the jQuery fullcalendar plugin but I've came across an issue regarding daylight savings time in Britain. After the daylight savings take effect the hours are being displayed an hour out of phase. The problem appears to be with the plugins parsing function. Can someone please provide me with the funciton to parse a U...

Storing date/times as UTC in database

I am storing date/times in the database as UTC and computing them inside my application back to local time based on the specific timezone. Say for example I have the following date/time: 01/04/2010 00:00 Say it is for a country e.g. UK which observes DST (Daylight Savings Time) and at this particular time we are in daylight savings. Wh...

PHP Default Timezone issue on Fedora + Zend Server CE

I have ZendServer CE (PHP 5.2) installed on a Fedora VM, and I have the system timezone set to 'America/Chicago'. I have date.timezone = 'UTC' in my php.ini file, and when I call date_default_timezone_get(), or display date('T') on a web page, it says 'CDT'. The documentation on php.net for date_default_timezone_get() says it follows th...

objective-c setting NSDate to current UTC

is there an easy way to init an NSDate with the current UTC date/time? ...

JAVA UTC to EST from a long UTC timestamp

I'm trying to convert a long timestamp that is UTC to Eastern Standard Time and am totally lost. Any hints would be great! Thanks, R ...

Force Java timezone as GMT/UTC

Hi. I need to force any time related operations to GMT/UTC, regardless the timezone set on the machine. Any convenient way to so in code? To clarify, I'm using the DB server time for all operations, but it comes out formatted according to local timezone. Thanks! ...

Java TimeZones: how to get UTC time values based on Console settings?

For example, when I extract from a database a Date() variable, it contains a date with "+04:00" shift. According to my locale's settings. So, UTC time is "ourTime" MINUS 4 hours. Then, a user tells where he/she is from. Now, we need to save his/her shift. LET'S SAY it is -01:00. And finally, this user tells us where's he/she is headin...

Safely convert UTC datetimes to local time (based on TZ) for calculations?

Following from my last question which @Jon Skeet gave me a lot of help with (thanks again!) I am now wondering how I can safely work with date/times, stored as UTC, when they are converted back to Local Date/Time. As Jon indicated in my last question using DateTimeOffset represents an instant in time and there is no way to predict wha...

How to fetch UTC dates with JavaScript?

I want to get the current UTC date with Javascript. How can I do this? There seems to be methods for getting the time in UTC: date.getUTCHours(); How can I get the date? ...

How to get date in specific locale with JavaScript?

I need to get the date in a specific locale using JavaScript - not necessarily the user's locale. How can I do this? I did some research and found date.getUTCMonth() and date.getUTCDate(). How can I use this or something else to get the date in a certain locale? ...

How reliable is DateTime.UtcNow in Silverlight applications?

I have a silverlight application which users will be running in various time zones. These applications load their data from the server upon start up, then cache it in IsolatedStorage. When I make changes to the data on the server, I want to be able to change the "last updated time" so that all silverlight clients download the newest da...

Python datetime not including DST when using pytz timezone

If I convert a UTC datetime to swedish format, summertime is included (CEST). However, while creating a datetime with sweden as the timezone, it gets CET instead of CEST. Why is this? >>> # Modified for readability >>> import pytz >>> import datetime >>> sweden = pytz.timezone('Europe/Stockholm') >>> >>> datetime.datetime(2010, 4, 20, 1...

PHP - why is this date function not erroring out

function convertDT($TS) { $TS = strtotime($TS); $TS -= date("Z"); $newTS = date("Y-m-d\TH:i:s\Z", $TS); return $newTS; } echo "Good: ".convertDT('2010-04-20 01:23:45')."\n"; echo "Bad: ".convertDT('2010-31-20 01:23:45')."\n"; The second date returns: 1969-12-31T23:00:00Z Why? Should this error? ...

Mysql: Convert DB from local time to UTC

I need to convert an existing (datetime fields) db from local time ut UTC. The values are stored ad datetimes on a server with time zone CET (+1) (with summertime +2). When selecting data I use UNIX_TIMESTAMP(), which magically compensates for everything, ie, time zone shift and dst (if i've read the docs right). I'm moving the db to a...