ainoy31 Posted August 8, 2008 Share Posted August 8, 2008 Hello- I am having an issue trying to figure out the beginning of the previous month. I am doing a previous billing cycle feature where I display three previous billing cycle from current date. This is what I am using to go back three months. $previousThreeBillCycle = mktime(0, 0, 0, date("m")-3, date("d"), date("Y")); $previousMonth = date("Y-m-d", $previousThreeBillCycle); That gets me the date of 2008-05-08. I know that the bill start date is on the first of every month and it is a monthly plan. I can't seem to think through the logic for this. Much appreciation. I hope this is clear enough. AM Link to comment https://forums.phpfreaks.com/topic/118846-solved-previous-date-issue/ Share on other sites More sharing options...
jonsjava Posted August 8, 2008 Share Posted August 8, 2008 <?php $previousThreeBillCycle = mktime(0, 0, 0, date("m")-3, 1, date("Y")); $previousMonth = date("Y-m-d", $previousThreeBillCycle); print $previousMonth; this assumes that the billing is always on the 1st. Link to comment https://forums.phpfreaks.com/topic/118846-solved-previous-date-issue/#findComment-612015 Share on other sites More sharing options...
ainoy31 Posted August 8, 2008 Author Share Posted August 8, 2008 Thanks for the help. It works. Much appreciation. Link to comment https://forums.phpfreaks.com/topic/118846-solved-previous-date-issue/#findComment-612018 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.