How do you convert the day of the year, say today which is the 100th day, to the actual date. In this case 04-10-2001.
I have tried a few ways, but there is no way to account for
the year buy looking at just 100. Any thoughts?
Wouldn't it be different based on whether the year had leap days in it?
You might be able to ask the user for a year, then try and calculate the date by comapring the value given as DayInYear versus FirstDayOfMonth(CreateDate(<year>,<month>,1).
Something like:
<cfset daysinyear=100>
<cfset currentmonth=1>
<cfloop condition="daysinmonth less than #DaysInMonth(createdate(year,currentmonth,1)#">
<cfset daysinyear=daysinyear-#daysInMonth(createdate(year,currentmonth,1)#>
<cfset currentmonth=currentmonth+1>
</cfloop>
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.