nezbo Posted October 13, 2008 Share Posted October 13, 2008 Hi all I have this code and I want to get the current financial year. i.e. april to april here is my code: $counted = gmmktime(00, 00, 00, 03, 31, 2001); $newCounted = gmmktime(); while ($counted <= $newCounted) { $counted = $counted + 31536000; } echo date("H:i:s - d/m/Y", $counted); this should return a date of 0:0:0 - 31/03/2009 but i get a date of 00:00:00 - 29/03/2009 I am not to sure what is wrong. Nezbo Link to comment https://forums.phpfreaks.com/topic/128176-adding-a-year-to-mktime/ Share on other sites More sharing options...
AndyB Posted October 13, 2008 Share Posted October 13, 2008 There were two leap years between 2001 and 2009. That's where your two day error comes from. Since the financial year always ends on March 31 regardless of the year, exactly what were you hoping to accomplish? Link to comment https://forums.phpfreaks.com/topic/128176-adding-a-year-to-mktime/#findComment-663841 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.