Site icon David Yin's Blog

Conver text to date in PHP

I have the text string as below:
04/02/08
It is text. Format is mm/dd/yy
But it is still can be recognized as yy/mm/dd or dd/mm/yy.
How to convert to the ISO date format?
I use PHP to do it.

date(‘Y-m-d’,strtotime(’04/02/08′))

It will convert the text to date and format it in ISO date.

Exit mobile version