vj5 Posted February 26, 2008 Share Posted February 26, 2008 Can someone please help in writing a function to convert date from 20080301 to saturday, march 1, 2008? Link to comment Share on other sites More sharing options...
Lulzim Posted February 26, 2008 Share Posted February 26, 2008 <?php$raw_date = "20080301";$formated_date = strftime("%b %d, %Y", strtotime($raw_date));echo $formated_date;?> for more info, check strtotime, strftime, date and mktime Link to comment Share on other sites More sharing options...
vj5 Posted February 26, 2008 Author Share Posted February 26, 2008 <?php$raw_date = "20080301";$formated_date = strftime("%b %d, %Y", strtotime($raw_date));echo $formated_date;?> for more info, check strtotime, strftime, date and mktime I need a function so that I can reuse it again and again for the date field. can someone please help? Link to comment Share on other sites More sharing options...
Lulzim Posted February 26, 2008 Share Posted February 26, 2008 if you can't convert that piece of code to a function than i doubt you will be able to use that function :Sanyway, here it is: <?phpfunction convert_date($raw_date){ return strftime("%b %d, %Y", strtotime($raw_date));}?> Link to comment Share on other sites More sharing options...
vj5 Posted February 26, 2008 Author Share Posted February 26, 2008 if you can't convert that piece of code to a function than i doubt you will be able to use that function :Sanyway, here it is:<?phpfunction convert_date($raw_date){ return strftime("%b %d, %Y", strtotime($raw_date));}?> Thank you. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.