Copy link to clipboard
Copied
How to get back the corresponding date according to 'ISO standard' while giving the week number and year as input. For example, Week=2 and year=2009, then result needed is 5-Jan-2009. Any function to achieve this?
Copy link to clipboard
Copied
Have you looked on cflib.org?
Copy link to clipboard
Copied
<cffunction name="getStartDateFromWeekNumber" hint="returns start date of the week, given the week number and the year">
<cfargument name="weekno" required="yes">
<cfargument name="year" required="yes">
<cfset var startDate = dateAdd("w",arguments.weekno,createdate(arguments.year,1,1))>
<cfreturn startDate>
</cffunction>
<cfset startDate = getStartDateFromWeekNumber(2,2009)>
<cfset startDate_formatted = dateFormat(startDate, "dd-mmm-yyyy")>
<cfoutput>#startDate_formatted#</cfoutput>