- 1). Create a variable for your date and the resulting week number. The following code creates a string and number variable:
myDate varchar(20);
week number; - 2). Assign a date to your Oracle variable. The following code shows you how to assign a variable in Oracle:
myDate := '1/1/2010' - 3). Retrieve the week number using the "to_date" function. The following code shows you how to retrieve the week of the year:
result := to_date(myDate, IW)
The "IW" parameter tells the function to return the week number.
previous post
next post