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 ? Quote Link to comment 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] Quote Link to comment 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. Quote Link to comment 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.