웹이야기

MySQL CONVERT_TZ() 본문

D/MySQL

MySQL CONVERT_TZ()

yeon.Biju 2020. 4. 1. 10:56

MySQL 날짜함수, 시간함수

 

CONVERT_TZ()

 

CONVERT_TZ(dt, from_tz, to_tz)

의 형태

 

   - 특정 시간에 대해 타임존(time zone)을 변경하여 변경된 시간을 return 하는 함수정도?

 

 

CONVERT_TZ() converts a datetime value dt from the time zone given by from tz to the the time zone given by to_tz and returns the resulting value. This function retuns NULL if the arguments are invalid.

 

If the value falls out the supported range of the TIMESTAMP type when converted from from_tz to UTC, no conversion occurs. 

 

 

mysql> SELECT CONVERT_TZ('2004-01-01 12:00:00', '+00:00', '+10:00') ;
+-------------------------------------------------------+
| CONVERT_TZ('2004-01-01 12:00:00', '+00:00', '+10:00') |
+-------------------------------------------------------+
| 2004-01-01 22:00:00                                   |
+-------------------------------------------------------+
1 row in set (0.00 sec)

 

 

 

'D > MySQL' 카테고리의 다른 글

MySQL CURRENT_DATE, CURRENT_DATE()  (0) 2020.04.01
MySQL CURDATE()  (0) 2020.04.01
MySQL ADDTIME()  (0) 2020.04.01
MySQL ADDDATE()  (0) 2020.04.01
MySQL Date and Time Functions  (0) 2020.03.31
Comments