Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Converting mysql date from one format to another

Tags:

date

mysql

I have stored a date in a field like this: 31st Dec 2013 but I need to alter it to something like this: 2013-12-31 00:00:00

I have tried lots of variations of DATE_FORMAT and strtotime but got nowhere. How do I go about this please?

like image 958
Mark Jones Avatar asked Jan 31 '26 12:01

Mark Jones


1 Answers

The DATE_FORMAT() function is used to display date/time data in different formats.

Try this:

DATE_FORMAT(your_date,'%Y %m %d %T:%f')
like image 79
Linga Avatar answered Feb 02 '26 05:02

Linga



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!