Home Sql Sqldate Mysql Date Format Convert



Mysql Date Format Convert
Posted on: April 3, 2006 at 12:00 AM
You already Know with the Query to find the current date and time. Now, we help you to convert the Mysql Date Format Conversion into other time zone.

Mysql Date Format Convert

     

You already Know with the Query to find the current date and time. Now, we help you to convert the Mysql Date Format Conversion into other time zone.

Understand with Example

The Tutorial illustrate an example 'Mysql Date Format Convert'. To grasp this concept we use Date now ( ) Query that return you the current today date and time.

now ( ) : The Query now ( ) return you the current date and time

Query for finding current date and time:-

mysql> select now()as date;

Output:-

+---------------------+
| date                |
+---------------------+
| 2008-12-22 10:05:20 |
+---------------------+
1 row in set (0.00 sec)

Query for converting current date and time to other timezone:-

Once you find out with the current date, we can convert the current date and time into other timezone. The below Syntax Query convert the current date and time to other timezone. 

SYNTAX:-CONVERT_TZ(date,from_tz,to_tz)

mysql> select convert_tz('2008-12-22 10:07:00','+05:30','-06:00')as ConvertedDate;

Output:-

+---------------------+
| ConvertedDate       |
+---------------------+
| 2008-12-21 22:37:00 |
+---------------------+
1 row in set (0.00 sec)

Related Tags for Mysql Date Format Convert:


More Tutorials from this section

Ask Questions?    Discuss: Mysql Date Format Convert  

Post your Comment


Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image
 
 

Ask Questions?

If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.

Ask your questions, our development team will try to give answers to your questions.