2

I have a date in string "20150617" that means 17 June 2015

How I can convert the String into "17-JUN-2015" using PHP Code.

Isti
  • 21
  • 1

2 Answers2

1

Use below code

<?php    
echo date('d-M-Y', strtotime('20150617'));
?>

date strtotime

Praveen D
  • 2,337
  • 2
  • 31
  • 43
  • Dont forget to set the default time http://php.net/manual/en/function.date-default-timezone-set.php – PHPhil Jun 19 '15 at 09:18
0

Use like this :

<?php
echo date('d-M-Y',strtotime(20150617))
?>
Ramki
  • 519
  • 2
  • 9