Sunday, February 19, 2012

calculation with dates challenge

I have a start and end datetime field and a field with the lunchbreak in
minutes. Now I need to find out the number of hours and minutes (HH:mm) this
person has worked.
endtime - starttime - lunchbreak and formatted in HH:mm.
Suggestions on how to go about this in Reporting services ?
PeterPeter,
You will want to do the following:
1) Do a 'DateDiff' and convert the endtime-starttime into minutes
e.g. DateDiff(m, Date1, Date2)
2) Do simple math to subtract the lunch break (if not in minutes, then
convert)
3) Divide the answer by 60 to get your hours
4) Take total minutes minus (60*hours) and this is your remainder minutes
5) format as desired.
if you require more info (ie, how to do date diff, or write it) let me know.
Michael
"Peter De Rop" wrote:
> I have a start and end datetime field and a field with the lunchbreak in
> minutes. Now I need to find out the number of hours and minutes (HH:mm) this
> person has worked.
> endtime - starttime - lunchbreak and formatted in HH:mm.
> Suggestions on how to go about this in Reporting services ?
> Peter

No comments:

Post a Comment