utc

Generating a drop down list of timezones with PHP

Most sites need some way to show the dates on the site in the users preferred timezone. Below are two lists that I found and then one method using the built in PHP DateTime class in PHP 5. I need help knowing which of these would be the best to attempt to use when trying to get the UTC offset from the user on register. One: <option v...

Why does Java return a date in GMT-4.5 when choosing Co-ordinated Universal Time time zone in Windows?

We have seen a strange issue on some Windows XP machines involving the "Co-ordinated Universal Time" time zone. Not all Windows XP machines seem to have it, but on those that do, the following simple Java program public class TimeTest { public static void main(String[] args) { System.out.println(java.util.TimeZone.getDefault...

How to manage timezones in a web application?

Hi, 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 ...

How to get current UTC time in JSON format using Javascript?

Hello, I have a JSON Date for example: "\/Date(1258529233000)\/" I got below code to convert this JSON date to UTC Date in String Format. var s = "\\/Date(1258529233000)\\/"; s = s.slice(7, 20); var n = parseInt(s); var d = new Date(n); alert(d.toString()); Now I need to get current UTC Date with Time and convert it into JSON da...

Converting string containing localtime into UTC in C

I have a string containing a local date/time and I need to convert it to a time_t value (in UTC) - I've been trying this: char* date = "2009/09/01/00"; struct tm cal = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL}; strptime(date, "%Y/%m/%d/%H", &cal); time_t t = mktime(&cal); but the time_t value I get back is the value that I would expect if ...

Convert a summer date to utc in the winter?

The function mktime takes a struct tm as argument. One of the members of struct tm is tm_isdst. You can set this to 1 for wintertime, 0 for summertime, or -1 if you don't know. However, if during winter, you try to convert 2009-09-01 00:00, mktime fails to see that although it is currently winter, the date you are converting is summert...

C# Define begin of day of a date in another timezone

Hi, I want to define the begin of a day in another timezone with .NET/C#. Example: My current timezone = GMT+1 so DateTime.Today returns 19/11/2009 23:00 UTC but actually I want to get the DateTime.Today for timezone GMT+2 which would be 19/11/2009 22:00 UTC. How do I do this without juggling with offsets & daylightsaving calcu...

Asp.net MVC overiding default getter and setters for linq to sql, for doing UTC conversions

Hi All, I'm getting to a point with my app where I'm about to try to roll out utc support. I've already got it all working and have written myself two utility classes, called convertToUtc and convertFromUtc. I think you can guess what they do. What I was thinking though, could I build these into the getter and setter methods for my da...

How can I format DateTime to web UTC format?

Hi, I have a DateTime which I want to format to "2009-09-01T00:00:00.000Z", but the following code gives me "2009-09-01T00:00:00.000+01:00" (both lines): Console.Out.WriteLine(new DateTime(2009, 9, 1, 0, 0, 0, 0, DateTimeKind.Utc).ToString("yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fffzzz")); Console.Out.WriteLine(new DateTime(2009, 9, 1, 0, 0, ...

How to determine UTC offset from server timezone?

I've found many examples about UTC tables and php date methods to convert it, but I still miss a simple way after got server date, to converting it into an user timezone selection on my web page. On this page http://vkham.com/UTC.html I've found a clear guide to understand the range, but I don't know how to connect for example "Europe/R...

Django DateTime field to generate timestamp fields withOUT timezone

I am working on a Django application where I need all the postgres represented datetime fields to be saved in UTC (as they should). When I'm creating models with DateTime fields they database representation is generated as "timestamp with time zone". Although I can manually alter the tables to remove the timezone from the fields, I was ...

In PHP: How to store the current time/date in UTC format in a string?

example: $date = 'Wed, 18 Feb 2009 16:03:52 GMT'; //How can I get $date to equal the current time in the same format? ...

How to get the fractional part of the seconds in UTCTime using time.h

I want to get the system time including fractional part of the seconds. Is it possible in standard c (ANSI C)? If not then tell me some libraries for window OS so that I make it possible. In Linux I have the following code with work fine for me. #include <sys/time.h> #inc...

SQL Server 2008 storage of xs:date and xs:time shifted to GMT

Is there any way to prevent SQL Server 2008 from interpolating dates and times passed as xs:date and xs:time to UTC? Currently we're running the server at EST and any times passed in are kicked back -05:00. We'd like to prevent this as it's a very serious issue. Regards. ...

SystemTimeToTzSpecificLocalTime - how to get utc offset and time zone

I have a need to convert a utc system time to local time and find the corresponding utc offset. I wouldn't mind getting the time zone also. As far as I can tell, SystemTimeToTzSpecificLocalTime returns no information on these. Anyone have a good way of determining the UTC offset and time zone? ...

php convert datetime to UTC

I am in need of an easy way to convert a date time stamp to UTC (from whatever timezone the server is in) HOPEFULLY without using any libraries. ...

How can I convert yyyy-mm-dd hh:mm:ss into UTC in Perl?

convert datetime format yyyy-mm-dd hh:mm:ss (Might be a string) into UTC, Looking into DateTime but I don't see how to parse the string? UPDATE: Is this working correctly? require 5.002; use strict; use warnings; use DateTime::Format::DateManip; my $string = '2010-02-28 00:00:00'; my @dates = ( $string ); for my $date ( @date...

Ruby Time.utc descrepencies

I'm running into discrepancies running the following command on different Ruby installations: Time.utc(2099, 12, 31, 23, 59, 59) On some systems I get an error, on some a valid response. Any ideas why this may be? ...

JDBC converting dates to UTC

Hi all, I have some code inserting a timestamp in a Postgres table. Here is the definition of the field where the timestamp is inserted: datelast timestamp without time zone I use this Java code to update data in the field: PreparedStatement sqlStatement = connection.prepareStatement( "UPDATE datetest SET datelast = ? WHERE ...

Need Help with JQuery UTC Date function

I am trying to use the Jquery Countdown plugin but I am having trouble with my UTC Date formatting. The date I wish to countdown to is Friday 23rd July 2010. Here is the relevant code... until: $.countdown.UTCDate(2010, 7 - 1, 23), format: 'YOD', The output is just 00.00.00 etc Can anybody help me? Thanks in adva...