0

IN PHPExcel_Reader_Excel5() I am reading date from first column but it throwing below format year as 2 digit but i want convert to 4 digit year with proper format

$date : 12-14-17

OUTPUT SHOULD BE

14-12-2017

  • Please do a search on either Google or here before asking a question. You will find most will have been answered already and all you need to do is give a good answer an upvote to say thanks – RiggsFolly Dec 20 '17 at 12:46
  • yes i got many answers for dd-mm-yyyy but not for dd-mm-yy here year has 2 digit – Raghu Darshan Dec 20 '17 at 12:50
  • Read ALL the answers in the Duplicate Question and **extrapolate** to fit your requirement – RiggsFolly Dec 20 '17 at 12:53
  • 1
    You ca do something like this :- $date = "12-14-17"; $d = explode("-",$date); $result = date('d-m-Y', strtotime($d[2]."-".$d[0]."-".$d[1])); – Deepak Dixit Dec 20 '17 at 12:58
  • Anything you could ever want to do with dates is probably covered by [DateTime](http://php.net/manual/en/class.datetime.php) ... – CD001 Dec 20 '17 at 13:14

1 Answers1

-2

echo date("mm-dd-yyyy", $date)

Try this.It will help you.

PRATEEK BHARDWAJ
  • 2,364
  • 2
  • 21
  • 35