-1

I am getting date format from database in YYYY-MM-DD format and I am using given code to convert this format.

$tempdate='2017-11-09';
$convertdate= date("d-m-y" , strtotime($tempdate));

but converted date is in 09-11-17, how can I convert this date into '09-11-2017'.

Funk Forty Niner
  • 74,372
  • 15
  • 66
  • 132
Yuvraj
  • 11
  • 1

3 Answers3

0
$tempdate='2017-11-09';
$convertdate= date("d-m-Y" , strtotime($tempdate));

you need to write the y uppercase to get the full year number

0

change your line from

$convertdate= date("d-m-y" , strtotime($tempdate));

to

$convertdate= date("d-m-Y" , strtotime($tempdate));
Naqash Malik
  • 1,619
  • 1
  • 10
  • 13
0

You just have to make 'y' capital - > 'Y'

lazzy_ms
  • 1,003
  • 1
  • 19
  • 36