User Guide Cancel

Week

 

Description

From a date/time object, determines the week number within the year.

Returns

An integer in the range 1-53; the ordinal of the week, within the year.

Category

Date and time functions

Function syntax

Week(date)
Week(date)
Week(date)

See also

DatePart

Parameters

Parameter

Description

date

(Required) A date/time object in the range 100 AD-9999 AD.

calendar (Optional) Values are either "iso" or "gregorian".

Usage

When passing a date as a string, enclose it in quotation marks. Otherwise, it is interpreted as a number representation of a date.

Example

<cfscript>
myDateTime = now();
WriteOutput(week(myDateTime & "<br/>"));
</cfscript>
<cfscript> myDateTime = now(); WriteOutput(week(myDateTime & "<br/>")); </cfscript>
<cfscript>
    myDateTime = now();
    WriteOutput(week(myDateTime & "<br/>"));
</cfscript>

Output

45

Get help faster and easier

New user?