Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

convert datetime from one timezone to another timezone

Posted on 2011-09-25
9
Medium Priority
?
352 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Lots of people ask this question on how to extend the “MembershipProvider” to make use of custom authentication like using existing database or make use of some other way of authentication. Many blogs show you how to extend the membership provider c…
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 this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…

670 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