digitalgod Posted July 12, 2006 Share Posted July 12, 2006 hey guys,why is this giving me February when it's supposed to give me March.... and is there a workaround?[code]<?php$bList = explode ('-',$row['date_birth']);echo $bList[1]; //outputs 03$birth_date = date('F', mktime(0, 0, 0, $bList[1], 0, 0));echo $birth_date; // outputs February.... not March????>[/code] Quote Link to comment Share on other sites More sharing options...
micah1701 Posted July 13, 2006 Share Posted July 13, 2006 from the manual:[quote]The last day of any given month can be expressed as the "0" day of the next month, not the -1 day. Both of the following examples will produce the string "The last day in Feb 2000 is: 29".<?php$lastday = mktime(0, 0, 0, 3, 0, 2000);echo strftime("Last day in Feb 2000 is: %d", $lastday);$lastday = mktime(0, 0, 0, 4, -31, 2000);echo strftime("Last day in Feb 2000 is: %d", $lastday);?> [/quote]so change the day of the month to 1 or any number other then 0[code]$birth_date = date('F', mktime(0, 0, 0, $bList[1], 1, 0));[/code] Quote Link to comment Share on other sites More sharing options...
digitalgod Posted July 13, 2006 Author Share Posted July 13, 2006 thanks missed that part! 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.