Hi,
what things do I have to consider when dealing with datetime in a asp.net web application?
I am also using sql server.
How can I ensure I don't run into problems with dates? (don't want to release it and THEN deal with it hehe)
Hi,
what things do I have to consider when dealing with datetime in a asp.net web application?
I am also using sql server.
How can I ensure I don't run into problems with dates? (don't want to release it and THEN deal with it hehe)
If you are also dealing with timezones you will want to take into account the offset from GMT - that would be the best is to record GMT time in your tabes and then you can figure for anyone in any time zone the right time
It really depends on the usage of the time and date
Always consider culture when parsing dates, in America we do MM/DD/YYYY, but overseas it is usually DD/MM/YYYY.
The DateTime class has an overload to take in the expected culture. Use it.
If your users are all in the same time zone and country, the answer is not much... But if you have the slightest inkling or know that you'll have users spanning time zones and different countries, there are a couple of items that really stand out.
It's a really (really) broad topic. But, if you are dealing with different time zones, different cultures and different languages, you could consider sticking to the ISO Standard for date and time representation. Also, it's better to store everything in the same time zone, all UTC for example. Here is a great article about all things datetime related in technet. There are also some new date time data types in SQL Server 2008 you might be interested in.