Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Listing out Payperiods 1

Status
Not open for further replies.

fmrock

Programmer
Sep 5, 2006
510
US
Hey Everyone,

I am trying to figure out how to list out the last 12 months of pay periods.

The pay periods are the 1st to 15th and the 16th to end of the month.

I allways want the prevous pay period to be the first one in my list.

Any help would be great.
 
Code:
<%
response.write "Pay periods<hr>"

dim dStartDate 
dim dEndDate 

dStartdate = date()
if day(dStartDate) > 15 then
 'Last pay period THIS month
 dStartDate = dateserial( year(date()),month(date()), 1)
else
 'Last pay period PREVIOUS month
 dStartDate = dateadd( "m", -1, date() )
 dStartDate = dateserial( year(dStartDate), month( dStartDate), 16) 
end if
dEndDate = dateadd("d", 14,  dStartDate)

do while dEndDate > dateadd("d", -365, date())
 response.Write dStartDate & " - " & dEnddate & "<br>"
 
 dEndDate = dateadd( "d", -1, dStartdate )
 
 if day(dEndDate) > 16   then
  dStartDate = dateserial( year(dEndDate), month( dEndDate), 16) 
 else
  dStartDate = dateserial( year(dEndDate), month( dEndDate), 1) 
 end if


loop
%>


?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top