-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,450
  • 15
  • 68
  • 141
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,707
  • 1
  • 12
  • 14
0

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

lazzy_ms
  • 1,169
  • 2
  • 18
  • 40