CFLib.org – Common Function Library Project

dayOfYearReverse(currentDayOfYear[, currentYear])

Last updated September 07, 2007

author

Jeff Houser

Version: 3 | Requires: CF6 | Library: DateLib

Description:
This function accepts the day of the year (One way to get that is with the DayOfYear function) and the year. It returns the date object for the given day of the year.

Return Values:
Returns a date.

Example:

<cfoutput>
#dayOfYearReverse(dayOfYear(now()))#
</cfoutput>

Parameters:

Name Description Required
currentDayOfYear Numerical day of the year. Yes
currentYear The year. Defaults to this year. No

Full UDF Source:

<!---
 This is the opposite of CFs DayOfYear function.
 v2 bug fix by David Levin (dave@angrysam.com)
 v3 fix by Christopher Jordan
 
 @param currentDayOfYear      Numerical day of the year. (Required)
 @param currentYear      The year. Defaults to this year. (Optional)
 @return Returns a date. 
 @author Jeff Houser (jeff@farcryfly.com) 
 @version 3, September 7, 2007 
--->
<cffunction name="dayOfYearReverse" returntype="date" hint="Accepts the day of Year (Integer) and year in question, and returns the date" output="false">
        <cfargument name="currentDayOfYear" type="numeric" required="yes">
        <cfargument name="currentYear" type="numeric" default="#year(now())#" required="no">
        <cfreturn dateAdd("d",arguments.currentDayOfYear, createDate(arguments.currentyear-1,"12","31" ))>
</cffunction>

Search CFLib.org


Latest Additions

Raymond Camden added
QueryDeleteRows
November 04, 2017

Leigh added
nullPad
May 11, 2016

Raymond Camden added
stripHTML
May 10, 2016

Kevin Cotton added
date2ExcelDate
May 05, 2016

Raymond Camden added
CapFirst
April 25, 2016

Created by Raymond Camden / Design by Justin Johnson