Time Zone - Daylight saving Issue

Hi,
I am programming an ASP.Net page with C#.
I have users from Australia (GMT +8) and Chile (GMT -3). Users uploads documento through this web the application.
It is very important that all documents have an exact (precise) creation date (YYY-MM-DD 00:00:00)
I need to display records in proper time whether it is for Chile users or Australian ones.
To stadarize, I am saving all times in GMT... Until here there is no issue... unless it is winter or summer...

In Chile they use "Daylight Saving" so if you are in Winter (July, August-September) you have GMT -3 and if you are in Summer (December, January-February) you have -4... and now raises the issue... how can I tell to my ASP.Net/C# application that if a record was saved in Summer the correct time is GMT-4 or if it was saved in Winter to use GMT -3?

I suspect that user machine can provide this information, but I don't know where.
Please I would really appreciate any help, comment or suggestion.
Many thanks.
LVL 2
José PerezAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Karrtik IyerSoftware ArchitectCommented:
Have you looked at the TimeZoneInfo class, it might do the work for you? You can save this information while saving the file and retrieve it while displaying the file again and convert the utc to local zone use this timezoneinfo class's  converttimefromutc function.
0
Jacques Bourgeois (James Burger)PresidentCommented:
I have never encountered that problem, so I made a few tests. I am in Canada, UTC-5, Windows 10, Framework 4.6. You might perform the same tests in your environments.

If I go in the Date and Time applet of the Control Panel, I have a notice that tells me that Dailight Saving Time will end on Novembre 1, 2015 at 2:00. So the OS knows about that.

If I asks for a second clock set to UTC, I get only 4 hours of difference. My Control Panel is very clear, I am in (UTC-5) Eastern Time (US and Canada). So the OS takes the DST into considerations.

I then tested in my code, and sitll have only the 4 hours of difference between datetime.Now and datetime.UtcNow. So the framework follows the OS on that correction.
0
José PerezAuthor Commented:
Yes, but that works ok for the present... now supposed you saved a document 3 years ago (in winter time GMT -4)  and you are now in summertime GMT -5. So you want to know the date and time it was saved. How will you tell your ASP.net / C# app that you saved in GMT -4 or GMT -5?
0
Cloud Class® Course: MCSA MCSE Windows Server 2012

This course teaches how to install and configure Windows Server 2012 R2.  It is the first step on your path to becoming a Microsoft Certified Solutions Expert (MCSE).

Jacques Bourgeois (James Burger)PresidentCommented:
There is a UTC component in the information that is saved with a file. The FileInfo class has a series of Utc methods on the dates.

I have never used them and do not have the time to test, but I would bet that they react as the OS does and that they take care of the situation at the location and time where the file was created.

Read the documentation carefully however. It looks like it uses the OS to do the job. It specifies that it's result is dependant upon the OS being kept properly configured and updated.
0
José PerezAuthor Commented:
Finally did it with Javascript, here you can find the solution:

Solution
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
frankhelkCommented:
The hint about UTC ("Universal Time Coordinated") is the important one.  UTC is the base of all local timestamps, and all local times are derived from it by applying offsets for location and DST.

UTC never has "steps" in it, besides the fact that every now and then a leap second is inserted or omitted to sync UTC with the unstabilities of earth's rotation. In that case the last minute of June 30 or Dec 31 has 61 or 59 seconds instead of the usual 60.

Most programming languages allow to derive UTC out of the DateTime objects (or from some system time value) by the runtime libs.

Besides of that, you should derive the timestamp on your server to prevent erronous (or possibly fraudulent) settings on your client's computers to interfere. If your server's clock is stable (see my article on NTP for a way to get reliable timekeeping), perfect timestamps should be achieved easy.
0
José PerezAuthor Commented:
Resolved myself.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
ASP.NET

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.