Sh M
asked on
SQL date and time and different time zone
Hi,
I have a .net application using SQL 2000 database. the application and DB is running on a server in US and therefore saving the time and date using US time. Being nearly one day in front of US time, I need to convert the dates to our time zone. In the database table the function getdate() is used for a date column. how can I modify it so I could save the date in the table using our time zone when data are submitted?
Thanks in advance
I have a .net application using SQL 2000 database. the application and DB is running on a server in US and therefore saving the time and date using US time. Being nearly one day in front of US time, I need to convert the dates to our time zone. In the database table the function getdate() is used for a date column. how can I modify it so I could save the date in the table using our time zone when data are submitted?
Thanks in advance
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Wizilling makes a good point and something I forgot to add. All systems I design store dates as UTC and then I convert to local time zones. Even with web applications you can convert the time zone at the client side using JavaScript. It eliminates a LOT of headaches.
Sadly I work at a large multi-national firm whose headquarters are in California. So guess which time zone is the default? (SIGH) Yes PST. So I often fix many bugs with date math issues due to some process misinterpreting the date time zone because the a developer assumed that the date was in their time zone.
Sadly I work at a large multi-national firm whose headquarters are in California. So guess which time zone is the default? (SIGH) Yes PST. So I often fix many bugs with date math issues due to some process misinterpreting the date time zone because the a developer assumed that the date was in their time zone.
DATEADD(day, 1, GETDATE()) will add one day onto the current date. You can use negative values as well.