What I save in database to be able to m? Need to convert to UTC?

My problem is: I have a lot of data containg a date time (in own local time) and I need to convert It to UTC. It looks so:

class Data
{
  int id; //Some id for database
  DateTime time; //Time in local time, i need to convert it to utc
}

//Converting:
1)Find this id in database and extract some info (which excatly?)
2)Convert time to UTC

My question is: which sort of data I need to keep in database in order to convert time correctly?

My version is: to keep an integer difference in hours between local time and utc and convert by adding It to local time. But Is this appropriate solution?

This entry was posted in Codes & Scripts and tagged , , , , . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>