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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ASP week calculation

Status
Not open for further replies.

MavrickStl

Programmer
Feb 20, 2001
71
US
Guys,

I am calculating no. of week using following code:

Dim iFirstDate, iCurrDate, iNoWeeks, iyear, imonth, iday,

iyear = year(date)
imonth = month(date)
iday = day(now)

iFirstDate = DateSerial(iyear,1,1)
iCurrDate = DateSerial(iyear,imonth,iday)

iNoWeeks = DateDiff("ww", iFirstDate, iCurrDate)

I have oracle DB backend. I am using a stored procedure to enter no. of week in the database. Oracle PL/SQL has following convention:

WW Week of year (1-53) where week 1 starts on the first day of the year and continues to the seventh day of the year.
W Week of month (1-5) where week 1 starts on the first day of the month and ends on the seventh.
IW Week of year (1-52 or 1-53) based on the ISO standard.

How can I synchronize week number generated by my ASP code and week number generated by my oracle stored procedure?
Let's assume that I am starting with year 2005.

Thanks,

Mav
 
MarvrikStl,

Fix the convention of first day of week, like this.
[tt]
iNoWeeks_oracle = DateDiff("ww", iFirstDate, iCurrDate, weekday(iFirstDate))
[/tt]
regards - tsuji
 
You may also consider the 4th argument of the DateDiff function.

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top