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] Link to comment https://forums.phpfreaks.com/topic/14429-mktime-problems-solved/ 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] Link to comment https://forums.phpfreaks.com/topic/14429-mktime-problems-solved/#findComment-57039 Share on other sites More sharing options...
digitalgod Posted July 13, 2006 Author Share Posted July 13, 2006 thanks missed that part! Link to comment https://forums.phpfreaks.com/topic/14429-mktime-problems-solved/#findComment-57103 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.