Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re: determining work hours between 2 dates

by poqui (Deacon)
on Jun 13, 2006 at 03:31 UTC ( #554942=note: print w/replies, xml ) Need Help??


in reply to determining work hours between 2 dates

The way we count workdays between 2 dates in data warehousing is to use a dimension table.

The Date Dimension will contain a row for every day in the calendar for a period of years; as far into the past as you are likely to care about, and at least 2 years into the future.
Each day is keyed with the date in date format (or you could use epochal date). There will be a column with a flag for Holiday, a flag for Weekday, and a flag for Workday.

We also have an aggregated column of Week_work_days_to_date, Month_work_days_to_date, Quarter..., Year..., Fiscal_year...; mainly because those are the most requested time spans.
If the time span you are interested in is not one of the standards, then you merely sum the the Workday flag for every day between your start and end dates.
  • Comment on Re: determining work hours between 2 dates

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://554942]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (3)
As of 2021-07-26 00:39 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?