Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Sql Sqldate Mysql Date Format Convert

Related Tutorials


 
 

Share on Google+Share on Google+

Mysql Date Format Convert

Advertisement
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)
Advertisement

If you enjoyed this post then why not add us on Google+? Add us to your Circles



Liked it!  Share this Tutorial


Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.

Posted on: April 3, 2006

Related Tutorials

Discuss: Mysql Date Format Convert  

Post your Comment


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