none
How to avoid time span in dataset? RRS feed

  • Question

  •  

    Hi,
    cenories is like i fill dataset from client machin which is in india. now that dataset is updating in Neterland server. but problem is occured that the data on server which have datetime field is oncrement by one day. i.e. is local database have value in datetime field 22/10/2007 then Netherland server database update to 23/10/2007 . this due to time span difference between us. is there any mehtod that will help me to avoid this adding of time span
    Monday, November 19, 2007 5:17 AM

Answers

  •  

    Hi

     

    When accessing the database from places with different time zones (even within the same country) it is suggested to use UTC time (universal time) to hold the datetime values (http://en.wikipedia.org/wiki/UTC). When saving UTC time to database you need to convert local time to UTC. When reading it from the DB, you need to convert it back to local time before showing it to user or explicitly state in the relevant column's name and description that the time is UTC and not local (for example, OrderTimeUTC).

     

    If you are using .Net, you can use DateTime.ToUniversalTime() to convert current or other time to UTC and DateTime.ToLocalTime() to convert back to local one.

     

    Let me know if you need more help,

     Nissim

    Tuesday, November 27, 2007 12:34 AM
    Moderator