CFLib.org – Common Function Library Project

dayOfYearReverse(currentDayOfYear[, currentYear])

Last updated September 7, 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>
blog comments powered by Disqus

Search CFLib.org


Latest Additions

Kevin Cotton added
date2ExcelDate
May 5, 2016

Raymond Camden added
CapFirst
April 25, 2016

Chris Wigginton added
loremIpsum
January 18, 2016

Gary Stanton added
calculateArrival...
November 19, 2015

Sebastiaan Naafs - van Dijk added
getDaysInQuarter
November 13, 2015

Created by Raymond Camden / Design by Justin Johnson