Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Getting number of working hours
Message
De
17/04/2015 10:31:59
 
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Syntaxe SQL
Versions des environnements
SQL Server:
SQL Server 2012
Application:
Web
Divers
Thread ID:
01618554
Message ID:
01618634
Vues:
41
>Could you post some example data and desired result from it?

For example, if my start and end time is 23/01/2014 09:15:00 and 29/01/2014 13:45:00, the SQL select might return a set of records like this for specific working shifts:

23/01/2014 08:00:00 - 23/01/2014 12:00:00
23/01/2014 13:00:00 - 23/01/2014 17:00:00
24/01/2014 08:00:00 - 24/01/2014 12:00:00
24/01/2014 13:00:00 - 24/01/2014 17:00:00
27/01/2014 08:00:00 - 27/01/2014 12:00:00
27/01/2014 13:00:00 - 27/01/2014 17:00:00
28/01/2014 08:00:00 - 28/01/2014 12:00:00
28/01/2014 13:00:00 - 28/01/2014 17:00:00
29/01/2014 13:00:00 - 29/01/2014 17:00:00

That could represent, for example, Thursday, Friday, Monday, Tuesday and Wednesday afternoon, assuming Wednesday morning was a holiday.

Those would have been selected because they fit within the range of the start and end dates.

So, here, I need to obtain 32.00 hours because this is the total amount of working hours that were eligible between the two dates.

If the start and end time would be 23/01/2014 09:20:00 and 29/01/2014 13:45:00, that would give 31.95 hours.
Michel Fournier
Level Extreme Inc.
Designer, architect, owner of the Level Extreme Platform
Subscribe to the site at https://www.levelextreme.com/Home/DataEntry?Activator=55&NoStore=303
Subscription benefits https://www.levelextreme.com/Home/ViewPage?Activator=7&ID=52
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform