CFLib.org – Common Function Library Project

getDaylightSavingTimeEnd([TheYear])

Last updated December 20, 2006

author

Ken McCafferty

Version: 1 | Requires: CF5 | Library: DateLib

Description:
Returns the date for the End of Daylight Saving Time for a given year. If no year is specified, defaults to current year.

Return Values:
Returns a date object.

Example:

<CFOUTPUT>
This year, Daylight Saving Time ends on #DateFormat(GetDaylightSavingTimeEnd(), 'dddd, mmm dd, yyyy')#.
</CFOUTPUT>

Parameters:

Name Description Required
TheYear Year you want to return the end of Daylight Saving Time. No

Full UDF Source:

/**
 * Returns the date for the End of Daylight Saving Time for a given year.
 * This function requires the GetLastOccOfDayInMonth() function available from the DateLib library.
 * 
 * @param TheYear 	 Year you want to return the end of Daylight Saving Time. (Optional)
 * @return Returns a date object. 
 * @author Ken McCafferty (mccjdk@yahoo.com) 
 * @version 1, December 20, 2006 
 */
function getDaylightSavingTimeEnd() {
	var TheYear=Year(Now());
  	if(ArrayLen(Arguments)) TheYear = Arguments[1];
	//US Congress changed it for 2007,may switch back
	// From last Sunday in October to First Sunday in November 
	if(TheYear lt 2007) return CreateDate(TheYear,10,GetLastOccOfDayInMonth(1,10,TheYear));
	else return CreateDate(TheYear,11,GetNthOccOfDayInMonth(1,1,11,TheYear));
	return CreateDate;
}
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