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 Quote 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 Quote 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. Quote 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 Quote 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 Quote Link to comment https://forums.phpfreaks.com/topic/118619-solved-date-conversion-help/#findComment-611288 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.