How to format now function in mysql
15,197
Solution 1
SELECT DATE_FORMAT(NOW(),'%Y%m%d%H%i%s')
Solution 2
select date_format(NOW(),'%Y%m%d%H%i%s') as date_val
Solution 3
Try:
DATE_FORMAT(NOW(),'%Y-%m-%d %h:%i:%s')
Comments
-
enigmaticus almost 2 years
Is there a way to format mysql NOW() So i would get something like year month day hours minutes seconds, all together, like this:
20130822143222
or to get something like microtime() in PHP, but for MySQL?
I need it for the trigger before insert. Thank you :)