-1

How to convert M d, D = Jan 17, Tue to Y-m-d = 2017-01-17 in PHP?

mySun
  • 1,550
  • 5
  • 32
  • 52

3 Answers3

3

Try this:

echo date('Y-m-d',strtotime('Jan 17, Tue'));
mith
  • 1,680
  • 1
  • 10
  • 12
3
echo date('Y-m-d',strtotime('Jan 17, Tue'));
Vaibhav Malve
  • 116
  • 1
  • 9
3
$date = DateTime::createFromFormat('d/m/Y', "17/01/2017");
echo $date->format('Y-m-d');

Source - http://www.php.net/manual/en/datetime.createfromformat.php

Hope this helps...

Prakash
  • 335
  • 3
  • 8