by glenwf » Tue Jan 27, 2015 2:51 pm
I have investigated calculating week of the year from the date. Googling that question I finally found somebody who had actually done it. The process is so complicated, that I didn't even try to put it into a database file and make it work. So, I just agreed with myself that I didn't have to be vary accurate.
My solution, which is not a good one, but gets me into the right neighborhood of being right. My use was selecting a week of the year (from the date) so I could order the data entries in chronological order within the year, ignoring the year date. Sorting by the date includes the year which doesn't help at all. I want to know when in the year would an insect probably be available so I sort by week and that gives me an answer what to look for this week.
The calculation I used was very simple (but not extremely accurate). I enter the date in a field just for reference and history of when I encountered the insect. I look at that and enter the following in separate fileds.
month
day
Once I have those 2 fields, I can do a calculation in another field:
== Week (calculated), the formula as it shows up in my calculated field...
(((30.4*(Mo-1))/7)+(day/7))
That is, average (((30.4 days / wk * (month - 1)) / 7 + (day / 7)
gotta subtract 1 from month then add days or Jan becomes Feb I discovered. 7 relates to 7 days per week of course. Hope this makes sense.
I know ecologists use this calculation, and it does show up on a Google calendar and is useful for events that occur at the same time each year which has a name ecologists use -
Phenology = science of biological seasonality. Study of timing of biological events. So this is a very useful tool, but I doubt HanDBase will go to the work to make it a sortable option using a date field. Would be nice...
Glen