Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

convert datetime from one timezone to another timezone

Posted on 2011-09-25
9
Medium Priority
?
355 Views
Last Modified: 2012-05-12
I have a datetime for example 09-25-2011 01:00am CET. How do I convert this time to another timezone for example EST or GMT. Thanks.
0
Comment
Question by:sandya_116
  • 4
  • 3
  • 2
9 Comments
 
LVL 5

Expert Comment

by:speak2ab
ID: 36596253
I usually use this site for converting time in different zones. http://www.timeanddate.com/worldclock/converter.html 

This should put you on the right direction. For basic programming purpose you might want to use the GMT as a reference point for other time conversions. GL
0
 

Author Comment

by:sandya_116
ID: 36596257
I am looking for asp.net code to do this.
0
 

Author Comment

by:sandya_116
ID: 36596266
The format on the start date time is flexible. But, it has a time and timezone for the start date. I need to convert this to the server's time zone datetime or another time zone.
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 5

Expert Comment

by:speak2ab
ID: 36596275
Now i see what you mean. I guess it will be clearer if you had included that in your question.

Have a look at this blog posts:
http://www.dotnetcurry.com/ShowArticle.aspx?ID=593

and

http://r4r.co.in/asp.net/01/tutorial/asp.net/Convert%20Time%20in%20Different%20TimeZones%20in%20ASP.NET%20using%20C-sharp.shtml
0
 
LVL 5

Expert Comment

by:speak2ab
ID: 36596283
For a step by step explanation of the steps read Scott's article
http://www.4guysfromrolla.com/articles/081507-1.aspx#postadlink
0
 

Author Comment

by:sandya_116
ID: 36596289
the zone asp.net is specified in the questions so I think everyone understands it. oh well, I already looked at these articles and didn't help me. The problem I have is I get this datetime with a timezone so that cannot be changed. I need to convert this to server timezone.
0
 
LVL 12

Accepted Solution

by:
rajapandian_81 earned 2000 total points
ID: 36597282
Hi,

Try below code:

DateTime DT = DateTime.ParseExact("09-25-2011 01:00am CET", "MM-dd-yyyy hh:mmtt CET", null);
TimeZoneInfo sourceTimeZone = TimeZoneInfo.FindSystemTimeZoneById("Central European Standard Time");
TimeZoneInfo DestTimeZone = TimeZoneInfo.FindSystemTimeZoneById("Eastern Standard Time");
DateTime DT_EST = TimeZoneInfo.ConvertTime(DT, sourceTimeZone, DestTimeZone);

Open in new window

0
 

Author Comment

by:sandya_116
ID: 36598582
Thanks rajapandian_81. That is working but just a quick question can it consider daylight saving time as well?
0
 
LVL 12

Expert Comment

by:rajapandian_81
ID: 36707619
It should consider daylight saving time.

To know the properties and methods:
http://msdn.microsoft.com/en-us/library/bb396389.aspx
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I have developed many web applications with asp & asp.net and to add and use a dropdownlist was always a very simple task, but with the new asp.net, setting the value is a bit tricky and its not similar to the old traditional method. So in this a…
A quick way to get a menu to work on our website, is using the Menu control and assign it to a web.sitemap using SiteMapDataSource. Example of web.sitemap file: (CODE) Sample code to add to the page menu: (CODE) Running the application, we wi…
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…
Look below the covers at a subform control , and the form that is inside it. Explore properties and see how easy it is to aggregate, get statistics, and synchronize results for your data. A Microsoft Access subform is used to show relevant calcul…
Suggested Courses

916 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question