Function PayPeriodStartDate(sDate)
'This function outputs the start of the pay period that sDate falls in.
'Pay Period Start Day: Sunday
'Pay Period End Day: Saturday
'Pay periods consist of a total of 14 days.
'Pay Period Ranges for 2005 thus far:
' 01-02-2005 – 01-15-2005
' 01-16-2005 – 01-29-2005
' 01-30-2005 – 02-12-2005
' 02-13-2005 – 02-26-2005
Dim sFirstEverPayPeriodStartDate
sFirstEverPayPeriodStartDate = "01-02-2005"
End Function
Response.Write(PayPeriodStartDate(“2/15/2005”))
Output should be: 2/13/2005
The above "code" is merely to help you visualize my problem.
As the description of the function tells, I am trying to figure out the date of the first day in a pay period that a given date falls in. I do NOT want to hard code the pay periods. I am having a hard time wrapping my head around the logic needed to determine the date.
I’m just not sure what I need to add to varA, subtract from varB, multiply varC by, in order to get varX. If I can get help with a formula to determine the date, I should be able to code it alright.
If you would be able to help, I would greatly appreciate it. Thank you for your time.
'This function outputs the start of the pay period that sDate falls in.
'Pay Period Start Day: Sunday
'Pay Period End Day: Saturday
'Pay periods consist of a total of 14 days.
'Pay Period Ranges for 2005 thus far:
' 01-02-2005 – 01-15-2005
' 01-16-2005 – 01-29-2005
' 01-30-2005 – 02-12-2005
' 02-13-2005 – 02-26-2005
Dim sFirstEverPayPeriodStartDate
sFirstEverPayPeriodStartDate = "01-02-2005"
End Function
Response.Write(PayPeriodStartDate(“2/15/2005”))
Output should be: 2/13/2005
The above "code" is merely to help you visualize my problem.
As the description of the function tells, I am trying to figure out the date of the first day in a pay period that a given date falls in. I do NOT want to hard code the pay periods. I am having a hard time wrapping my head around the logic needed to determine the date.
I’m just not sure what I need to add to varA, subtract from varB, multiply varC by, in order to get varX. If I can get help with a formula to determine the date, I should be able to code it alright.
If you would be able to help, I would greatly appreciate it. Thank you for your time.