calculate week of year from date

This forum is for application developers who are integrating HanDBase into their solutions via the HanDBase API (HAPI) or other means. It's also a great place to discuss runtime development.

calculate week of year from date

Postby 62erwin » Sun Dec 21, 2014 4:30 am

Can i calculate the week of year from date?

Sorry my english !!!!
Posts: 1
Joined: Sun Dec 21, 2014 4:17 am

Re: calculate week of year from date

Postby piksel » Wed Jan 21, 2015 6:52 pm

I don't understand the problem you have :)
Posts: 3
Joined: Wed Jan 21, 2015 6:50 pm

Re: calculate week of year from date

Postby 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.


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...

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...

Posts: 229
Joined: Wed May 20, 2009 5:34 pm
Location: Roseville, CA

Re: calculate week of year from date

Postby » Mon Jun 01, 2015 8:50 pm

The ISO standard for week of year calculation states that the first week of the year is the first one that includes a Thursday. A week is defined as a 7 day period within a calendar year which starts on a Monday.
Posts: 19
Joined: Fri Oct 25, 2013 8:23 pm

Return to HanDBase - Developers

Who is online

Users browsing this forum: No registered users and 1 guest