sql - Convert MySQL Month/Year to Datetime or Unixtime -
i have mysql column in following format, how can convert datetime or unixtime format.
existing format
february 2015
required format
2015-02-01 00:00:00
any idea how can done using mysql?
you can use str_to_date
, date_format
this
mysql> select date_format(str_to_date('february 2015','%m %y'),'%y-%m-01 %h:%i:%s') date; +---------------------+ | date | +---------------------+ | 2015-02-01 00:00:00 | +---------------------+ 1 row in set (0.00 sec)
Comments
Post a Comment