CFLib.org – Common Function Library Project

dayOfYearReverse(currentDayOfYear [, currentYear])

Last updated September 7, 2007

Version: 3 | Requires: ColdFusion MX | Library: DateLib

 
Rated 0 time(s). Average Rating: 0

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:

view plain print about
<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:

view plain print about
<!---
 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 (dave@angrysam.comjeff@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

Dave Anderson Dave Anderson added
iniToStruct
20 day(s) ago

Dave Anderson Dave Anderson added
deDupeArray
20 day(s) ago

Richard Richard added
dice
22 day(s) ago

Isaac Dealey Isaac Dealey added
getRelative
a while ago

Top Rated

Darwan Leonardo Sitepu backupDatabase
Rated 5.0, 22 time(s)

Barney Boisvert indentXml
Rated 5.0, 10 time(s)

Kevin Pepperman generateSsccAsn
Rated 5.0, 4 time(s)

Raymond Camden highlightAndCrop
Rated 5.0, 4 time(s)

Created by Raymond Camden / Design by Justin Johnson