본문 바로가기
etc/Database(SQL)

MariaDb, MySql datetime query.

by swconsulting swconsulting 2018. 5. 31.


SELECT

NOW(),

DATE_ADD(

NOW(),

INTERVAL 9 HOUR

),

date_format(

NOW(),

'%Y-%m-%d %H:00'

),

date_format(

DATE_ADD(

NOW(),

INTERVAL 9 HOUR

),

'%Y-%m-%d %H:00'

) ;


[Output]

2018-05-30 21:26:27, 2018-05-31 06:26:27, 2018-05-30 21:00,   2018-05-31 06:00

댓글0