# Time Difference

## Recommended Posts

I know I can't be the only one looking for The time difference on a 9/80 secdual
(ie first week Mon-Thurs 9 hours, Fri 8 hours, second week Mon-Thu 9 hours Friday off)
Any pointer will help ( I have searched the form and haven't found what I want)

##### Share on other sites

Can you elaborate?  The time difference between 9/80, and what?

Spoiler

Misc Code Snippets:
Projects: SubnetCalc
Cool Stuff:

##### Share on other sites

I saw it.  What exactly are you trying to calculate/accomplish?

Maybe this is something to play with.

```#include <date.au3>

Local \$iYear = 2022
Local \$iMonth = 1
Local \$iDay = 2

For \$i = 2 to 15
Local \$iHours = _Calculate9x80WorkHoursFromDate(\$iYear, \$iMonth, \$iDay)
\$sDayOfWeek = _DateDayOfWeek(_DateToDayOfWeek(\$iYear,\$iMonth,\$iDay),\$DMW_LOCALE_LONGNAME)
\$sDate = StringFormat("%-24s", \$iYear & "/" & \$iMonth & "/" & \$iDay & " (" & \$sDayOfWeek & "): " )
ConsoleWrite(\$sDate & ((IsNumber(\$iHours)) ? \$iHours & " hours" : \$iHours) & @CRLF)
\$iDay += 1
Next

Func _Calculate9x80WorkHoursFromDate(\$iYear, \$iMonth, \$iDay)
;Determine Day of the Week from Date YYYY MM DD
\$iWeekDay = _DateToDayOfWeek(\$iYear,\$iMonth,\$iDay)
If @error Then Return -1

Local \$iHours = ""
Switch \$iWeekDay
Case 2 To 5
;If Day of the Week is Monday - Thursday, Work hours is 9
\$iHours = 9
Case 6
;If Day of the Week is Friday, Calculate work hours based on Week number - Odd Week's are Off Fridays; Even week's work hours are 8
\$iHours = (Mod(_WeekNumberISO(\$iYear, \$iMonth, \$iDay),2)) ? "Off Friday" : 8
Case Else
\$iHours = "Off day"
EndSwitch

Return \$iHours
EndFunc```

Edited by spudw2k
Spoiler

Misc Code Snippets:
Projects: SubnetCalc
Cool Stuff:

## Create an account

Register a new account

• ### Recently Browsing   0 members

×

• Wiki

• Back

• #### Beta

• Git
• FAQ
×
• Create New...