Take the 2-minute tour ×
Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It's 100% free, no registration required.

In a MySQL DB, I have two varchar fields. One is for date and one is for time. I need to change the time from CST to GMT. In MySQL how do we convert the combination of these date and time fields from CST to GMT time? It could be helpful if I get some sample queries for retrieve the same.

share|improve this question
    
What format are the current date strings in? dd/mm/YY/, mm/dd/YYYY, dd-mm-YYYY or something else? –  Stuart Moore Oct 30 '12 at 15:18
    
current format is mm/dd/YYYY –  Sajith Oct 31 '12 at 3:24

1 Answer 1

up vote 3 down vote accepted

You would use the CONVERT_TZ function like this:

SELECT CONVERT_TZ('2012-01-01 12:00:00','-06:00','+00:00')

Example SQL Fiddle

But, why are you using varchar for your date/time fields? It would be better to use the proper data types DATE and TIME.

share|improve this answer
    
Thanks For the answer.This will work.. –  Sajith Nov 1 '12 at 2:57

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.