-1

I'm stuck in a problem with regular expressions. I have a code where I print the value extracted from XML file in between the braces.

<td>{{dob}}</td>  

So, here dob contains the date in yyyy-mm-dd (2013-12-03), but I want it in dd mm yyyy (3 Mar 2013). How can I print the value of date in above format using php echo.

EDIT Now, currently it prints the values in YYYY-mm-dd format. Iwant to change the format

90

user3004356
  • 870
  • 4
  • 16
  • 49
  • Have you spotted the box near the top right of the page yet - the one with *"search"* written in it? [Here is just one](http://stackoverflow.com/questions/2487921/convert-date-format-yyyy-mm-dd-dd-mm-yyyy) of the countless threads already covering this. Also, by the sound of it *regex* seems like overkill. – Emissary Dec 07 '13 at 13:21

1 Answers1

1

If $dob is a string variable containing the date in its original format (e.g., '2013-12-03'), then this will output the date in the format you want:

echo date('j M Y',strtotime($dob));

More info here: http://php.net/date

r3mainer
  • 23,981
  • 3
  • 51
  • 88