suyesh.amatya Posted August 7, 2008 Share Posted August 7, 2008 i have date format as 2000808(yyyymm) now how can i display it like aug,2008 in php Link to comment https://forums.phpfreaks.com/topic/118619-solved-date-conversion-help/ Share on other sites More sharing options...
MasterACE14 Posted August 7, 2008 Share Posted August 7, 2008 use date(); function, look it up in the PHP manual Link to comment https://forums.phpfreaks.com/topic/118619-solved-date-conversion-help/#findComment-610653 Share on other sites More sharing options...
suyesh.amatya Posted August 7, 2008 Author Share Posted August 7, 2008 echo date ( 'Y-M' , 2000808); the above mentioned date is diplayed as 1970-Jan.I want it as 20008-aug. Link to comment https://forums.phpfreaks.com/topic/118619-solved-date-conversion-help/#findComment-610670 Share on other sites More sharing options...
kenrbnsn Posted August 7, 2008 Share Posted August 7, 2008 The string "2000808" is not a valid date string. If you mean "200808", do <?php $str = "200808"; echo date('Y-M,$str . "01"); ?> Ken Link to comment https://forums.phpfreaks.com/topic/118619-solved-date-conversion-help/#findComment-610700 Share on other sites More sharing options...
suyesh.amatya Posted August 8, 2008 Author Share Posted August 8, 2008 $year='2008'; $month='08'; $my_date=$year."-".$month; $my_time = strtotime($my_date); echo date(" F Y", $my_time); This gives the desired result as August 2008. Thanks Link to comment https://forums.phpfreaks.com/topic/118619-solved-date-conversion-help/#findComment-611288 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.