Log in

View Full Version : date formatting



awakener1986
01-21-2010, 07:46 AM
hi i was wondering if any1 could help me with this.

i am receiving data in this format:
1207
which is the month followed by year : mmyy

so i was wondering if i could change this to a real date format
as in like dd/mm/yyyy

01/12/2007

thanks

Jeremy Ross
01-21-2010, 11:22 AM
Here is a bit of code that will point you in the correct direction:



<?php
$str = '1207';
echo date('F j, Y', mktime(0,0,0,$str{0}.$str{1},1,$str{2}.$str{3}));
?>

awakener1986
01-22-2010, 02:21 AM
Thanks exactly what i needed :)