Windows App and Web services

nismo

Member
Joined
Jun 30, 2006
Messages
18
Programming Experience
3-5
I have a windows app which is used in australia and uses web services to communicate with the database located in new zealand. I have a problem where dates that are returned from SQL are automatically modified to suit the timezone and i dont know how to turn it off.

For example, i insert the value '10/Jan/2006 20:00' into the database from a PC located in australia. When that data is selected back out, a 4 hour time offset is automatically applied to it and the time is returned as '10/Jan/2006 16:00'.

My current workaround is to modify my queries to say;

"Select convert(varchar, tb_date) tb_date from tablename"

Which returns the date as a string rather than a datetime which means the time offset is not applied.

This is a really poor solution and i'd be really keen to find out a better way...
Thanks
 
Look at the DateTime class and the methods such as DateTime.ToLocal... .ToUTC, etc. You can figure it out from there.

Ok thanks.

I was kinda hoping i wouldn't have to modify my entire project and add additional functions to every occurrence of a date - it would be alot easier to just somehow change my web service to state the date values should not have any offset's applied on the target machine
 
Back
Top