Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Get the week's start date

Guest
Nov 02, 2010 Nov 02, 2010

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?

467
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Nov 03, 2010 Nov 03, 2010

Have you looked on cflib.org?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Nov 04, 2010 Nov 04, 2010
LATEST

<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>

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources