lxndr Posted May 15, 2006 Share Posted May 15, 2006 I know that you can output the number of the day of the year using date(z) but is there a simple way of outputting the date in a different format by passing the number of the day of the year instead? e.g. by passing the number 134 to a function you get the output 15th May ? Link to comment https://forums.phpfreaks.com/topic/9701-date-question/ Share on other sites More sharing options...
zq29 Posted May 15, 2006 Share Posted May 15, 2006 This should work...[code]<?phpfunction return_date($day,$year=2006) { $stamp = mktime(0,0,0,1,$day,$year); $date = date("jS F Y",$stamp); return $date;}echo return_date(134);?>[/code] Link to comment https://forums.phpfreaks.com/topic/9701-date-question/#findComment-35960 Share on other sites More sharing options...
lxndr Posted May 15, 2006 Author Share Posted May 15, 2006 [!--quoteo(post=374001:date=May 15 2006, 02:24 PM:name=SemiApocalyptic)--][div class=\'quotetop\']QUOTE(SemiApocalyptic @ May 15 2006, 02:24 PM) [snapback]374001[/snapback][/div][div class=\'quotemain\'][!--quotec--]This should work...[code]<?phpfunction return_date($day,$year=2006) { $stamp = mktime(0,0,0,1,$day,$year); $date = date("jS F Y",$stamp); return $date;}echo return_date(134);?>[/code][/quote]Works great! Thanks a bunch, really appreciate the help. Link to comment https://forums.phpfreaks.com/topic/9701-date-question/#findComment-35980 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.