| SitePoint Sponsor |
"Folks who know what they're doing make complexity seem simple."


Yeah, I know. I had to run it three times to verify I didn't flub it up with some stupid mistake, but it does indeed do that. *sigh*, not as infallible as I was led to believe, but, I do appreciate the fact that like PHP, it does give you tools to get better validity when you need it (such as getting the last day in a given month consistently).
Off Topic:
Stupid calendar makers.
Never grow up. The instant you do, you lose all ability to imagine great things, for fear of reality crashing in.

Fer realz.
What I'm doing is running a daily batch of usage per billing cycle. A customer's billing cycle can land on any day (1-31). Daily I need to calculate their usage for their bill cycle. So today, the 25th, I'd be calculating for everyone whos bill cycle is on the 25th (Jan - Dec). On the 28th, I will run 4 seperate batches for the 28th, 29th, 30th and 31st to handle months that do not have certain days. This is why I need to be able to run on fictional dates..
I'm going to use literal strings in this function to avoid any unwanted side effects, and handle the year by hand. I'll post the code when I have completed.
<?php//Kyle Wolfeecho devBlog("My Dev Notes");

Ugly but whatever:
Code PHP://bill cycle date to run for $day = 25; $month = 1; $year = 2013; if($month == 1) { $startDate = ($year-1) . '-12-' . $day; $endDate = $year . '-' . $month . '-' . $day; } else { $startDate = $year . '-' . ($month-1) . '-' . $day; $endDate = $year . '-' . $month . '-' . $day; }
<?php//Kyle Wolfeecho devBlog("My Dev Notes");
Bookmarks