Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Converting daytime from Eastern Standart time to UTC

Status
Not open for further replies.

HenryMonster

Programmer
Feb 21, 2002
74
US
Hi All,

I need to convert a daytime field expressed as
Eastern Satndart time to UTC.

Can anybody suggest a quick way to accomplish
this in mySql ?

Thank you in advance,

HenryMonster
 
Try the DATE_ADD function:

SELECT DATE_ADD(dateTimeField,INTERVAL gmtDifference HOUR);

YEAR, MONTH, DAY, HOUR, MINUTE, SECOND are valid intervals, and + and - can be used to indicate direction.

GMT is 5 hours GREATER than EST (Greenwich is East of us), if I remember correctly.
 
Thank you for response VuduDoc !

The problem actually is that the time difference is
not always the same. What happens is that the dates
when the local time switches to the summer or winter
time happens float from year to year; I also may guess
that differen time zones may have different switch over
rules. So I was looking for a function in mySQL, which
potentially could receive a local time (date including)
and some sort of a local time zone code and return
the local datetime properly converted to UTC.

Pessimistically, I'd like to find general guidlines
as to how to make this conversion manually, which
precludes the knowledge of when the local switch-overs
are done, etc.

Any suggestions ?



Thanks in advance again !


HenryM
 
I don't know that there are any general guidelines. According to the time zone info on my Linux box, there are 374 sets of timezone switch-over rules. It shows 23 just for the United States. ______________________________________________________________________
TANSTAAFL!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top