Share via


Convertintg datetime of PST to UTC time

Question

Monday, January 19, 2009 3:05 AM

 Hi All,

I have a datetime value **"2009-01-16T15:40:29.937" ** of PST TimeZone,

I want to convert this time to UTC format. 

Can anybody help in getting this done?

 

Thanks in advance

Suresh Kumar Goudampally

 

 

 

All replies (5)

Tuesday, January 20, 2009 6:23 AM âś…Answered

In case of asp.net 2.0 you can refer the below article...

http://www.codeproject.com/KB/datetime/timezoneconversions.aspx

 

hope this helps


Monday, January 19, 2009 3:52 AM

 Hi,

try this

 

Response.Write(((DateTime)(Convert.ToDateTime("2009-01-16T15:40:29.937")).ToUniversalTime()));


Monday, January 19, 2009 3:54 AM

refer the url

http://msdn.microsoft.com/en-us/library/bb382770.aspx

sample code

The ability to convert directly from one timezone to another is in .NET 3.5 with the help of System.TimeZoneInfo object.

Example C# Code:
DateTime oldTime = new DateTime(2007, 6, 23, 10, 0, 0);
TimeZoneInfo timeZone1 = TimeZoneInfo.FindSystemTimeZoneById("Central Standard Time");
TimeZoneInfo timeZone2 = TimeZoneInfo.FindSystemTimeZoneById("Eastern Standard Time");
DateTime newTime = TimeZoneInfo.ConvertTime(oldTime, timeZone1, timeZone2);

 

hope this helps


Tuesday, January 20, 2009 3:57 AM

 Hi,

This can implemented using MS.Net 3.5 and i am working on .Net 2.0,

 

 

Thanks

Suresh Kumar Goudampally

 


Tuesday, January 20, 2009 6:27 AM

In case of asp.net 2.0 you can refer the below article...

http://www.codeproject.com/KB/datetime/timezoneconversions.aspx

 

hope this helps