mysql - Converting String to date in PHP for Date and time like 18 July, 2013 12:00 -


i have date , time stored string in following format "18 july, 2013 12:00" in mysql database.

i using wordpress website, date meta_key of post.

i need them converted, string date , time.

strtotime() function not working format. want saperate month , date.

also tried echo date( 'format', strtotime("18 july, 2013 12:00") gives 01/01/1970 output

i think reason why it's not working because of format passed on str_to_date() invalid. try this,

select str_to_date(yourcolumn, '%d %m, %y %h:%s') newdatetime   tablename 

but if want separate month , date, resulting value string month.

select date_format((str_to_date(yourcolumn, '%d %m, %y %h:%s'), '%m') month,        date(str_to_date(yourcolumn, '%d %m, %y %h:%s')) dateonly   tablename   tablename 

Comments

Popular posts from this blog

javascript - DIV "hiding" when changing dropdown value -

Does Firefox offer AppleScript support to get URL of windows? -

android - How to install packaged app on Firefox for mobile? -