Tuesday 17 September 2013

Re: [dcphp-dev] Repeating pattern incongruent to any calendar increment

I think with leap seconds you might get in trouble, but if it's 70 calendar days, then couldn't you simply calculate 70 days in seconds and then calculate from the Epoch[1], or the Epoch + whatever to get you to a date you wanted to start?

That obviously wouldn't work for historical dates before 1970, but if you're dealing with modern things, I'd think you'd be in good shape, at least close enough to a day.


On Sep 17, 2013, at 2:52 PM, Anthony D Paul <anthonydpaul@gmail.com> wrote:

I'm trying to think of a better means of determining a set of values for "today" based on a repeating pattern.

I have this schedule that follows a repeating pattern of blocks of 70 days (10 weeks). 70 doesn't map to anything useful in a calendar year, and there is no logical way I see of deriving today's schedule from the date without a fixed reference in history. I can take an arbitrary historical date and assign it a position within the 70-day pattern, then query and calculate the series of schedules in contemporary time from start date to end date, but that seems frivolous to reference a date that far into history.

Alternatively, I could calculate and cache a set of reference points (position 1 in every block of 70, e.g.) and compare today's date to select the date closest to today's date and advance the pattern from there.

Perhaps I'm thinking about this wrong though. Is there a numerical date system (for example, today's date might be day 12873461 from a fixed point in history) where I could simply divide by 70 and grab the remainder? Then, use the date function to convert that number into an EST date stamp?

Thanks,
Anthony

--
You received this message because you are subscribed to the Google
Group: "Washington, DC PHP Developers Group" - http://www.dcphp.net
To post, send email to washington-dcphp-group@googlegroups.com
To unsubscribe, send email to washington-dcphp-group+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/washington-dcphp-group?hl=en
---
You received this message because you are subscribed to the Google Groups "Washington, DC PHP Developers Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to washington-dcphp-group+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

--
Sandy Smith - http://musketeers.me/
php[architect] magazine: http://phparch.com/

@SandyS1





0 comments:

Post a Comment