473,396 Members | 1,858 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Timezones

Greetings to everyone

I need an advice if possible
I have to convert times between two timezones witch none of them is local.
And this have to work historically.

I tried with :
DateTime time2 = TimeZoneInfo.ConvertTime(time1, timeZone1, timeZone2);

but it seems to get confused by the local DST change and not the timeZone1 DST change.

Is there any solution ( via LINQ)

Thanks in advance
Oct 27 '09 #1

✓ answered by garbmail10

quick example of the above tryout :


Expand|Select|Wrap|Line Numbers
  1.  private DateTime timezone_convert(DateTime time1, string zone1, string zone2) {
  2.     TimeZoneInfo timeZone1 = TimeZoneInfo.FindSystemTimeZoneById(zone1);
  3.     TimeZoneInfo timeZone2 = TimeZoneInfo.FindSystemTimeZoneById(zone2);
  4.  
  5.     DateTime time2 = TimeZoneInfo.ConvertTime(time1, timeZone1, timeZone2);
  6.     return time2;
  7.  
When i run the timezone_convert(time1, "Eastern Standard Time", "GMT Standard Time")

for 24/10/2009 09:30:00 and 25/10/2009 09:30:00 it returns
24/10/2009 01:30:00 and 25/10/2009 02:30:00 because locally(GMT+2) the DST changed

1 1642
quick example of the above tryout :


Expand|Select|Wrap|Line Numbers
  1.  private DateTime timezone_convert(DateTime time1, string zone1, string zone2) {
  2.     TimeZoneInfo timeZone1 = TimeZoneInfo.FindSystemTimeZoneById(zone1);
  3.     TimeZoneInfo timeZone2 = TimeZoneInfo.FindSystemTimeZoneById(zone2);
  4.  
  5.     DateTime time2 = TimeZoneInfo.ConvertTime(time1, timeZone1, timeZone2);
  6.     return time2;
  7.  
When i run the timezone_convert(time1, "Eastern Standard Time", "GMT Standard Time")

for 24/10/2009 09:30:00 and 25/10/2009 09:30:00 it returns
24/10/2009 01:30:00 and 25/10/2009 02:30:00 because locally(GMT+2) the DST changed
Oct 27 '09 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: B. G. Mahesh | last post by:
hi I am using PHP 4.x and MySQL. The database has the list of countries, cities and timezones. I would like to convert the time from one zone to another zone . It is not that difficult to...
0
by: Symon R | last post by:
This is a bit of a weird one that I haven't yet been able to solve - I'm hoping someone out there can disprove my findings and tell me where I've gone wrong! I have designed a web service that...
13
by: Michael | last post by:
I would like to set the timezone of a thread to allow me to calculate the UTC time for data sourced from a number of time zones. Although this can be done in C and C++, I annot find how to do...
0
by: Robert Treat | last post by:
I am trying to figure out if there is a way to determine the timezones supported in postgresql from within the database. If you look at...
1
by: Flack | last post by:
Hey guys, I need to compare two times that the user selects. The user selects the hour, date, and timezone (which can be either NY, LN, or HK timezones). How can I compare two dates of...
5
by: Alex | last post by:
Hi My website is hosted in the States (EST), but the website itself is targeted for UK users (GMT). How can I offset the time so that the server reports it as GMT when my ASP.NET app needs to...
7
by: =?Utf-8?B?U3R1?= | last post by:
I have a ASP.NET Ajax app (using client library) calling ASP.NET Ajax-enabled web services. We are making use of the javascript proxies generated by ASP.NET Ajax. The problem we have is that the...
3
by: Daz | last post by:
Hello everyone. I am creating a JavaScript project which will allow users to see what time it is in other countries. I am wondering if there's any way to have the server work this out, without...
7
by: David T. Ashley | last post by:
In a web database (PHP), per user, I'd like to allow each user to specify their timezone (this would change how times are adjusted for display for that user). How do I enumerate all possible...
27
by: Sanjay | last post by:
Hi All, I am using pytz.common_timezones to populate the timezone combo box of some user registration form. But as it has so many timezones (around 400), it is a bit confusing to the users. Is...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.