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.


 
Ads

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)

Advertisements

Ads
Share on Google+Share on Google+

Mysql Date Format Convert

Posted on: April 3, 2006 If you enjoyed this post then why not add us on Google+? Add us to your Circles

Advertisements

Ads
 

Discuss: Mysql Date Format Convert  

Post your Comment


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

Ads

 

Ads