mysql - SQL date format convert? [dd.mm.yy to YYYY-MM-DD] -


is there mysql function convert date format dd.mm.yy yyyy-mm-dd?

for example, 03.09.13 -> 2013-09-03.

since input string in form 03.09.13, i'll assume (since today september 3, 2013) it's dd-mm-yy. can convert date using str_to_date:

str_to_date(myval, '%d.%m.%y') 

then can format string using date_format:

date_format(str_to_date(myval, '%d.%m.%y'), '%y-%m-%d') 

note year %y (lowercase "y") in str_to_date , %y (uppercase "y") in date_format. lowercase version two-digit years , uppercase four-digit years.


Comments

Popular posts from this blog

html - How to style widget with post count different than without post count -

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

javascript - storing input from prompt in array and displaying the array -