Get the first and last day of the current year

I need to pull some information from my db where the date is between the first and last day of the year. I’ve got the same thing working for month but I was wondering if anyone had code that did this already.

Anyone?

Found it…

Here’s some functions which get all of the above listed date ranges:


<cfscript>
function FirstDayOfTheMonth(strDate) {
	return CreateDate(Year(strDate), Month(strDate), 1);
}

function LastDayOfTheMonth(strMonth) {
	var strYear=Year(Now());
	if (ArrayLen(Arguments) gt 1)
	strYear=Arguments[2];
	return DateAdd("d", -1, DateAdd("m", 1, CreateDate(strYear, strMonth, 1)));
}

function FirstDayOfTheYear() {
	return CreateDate(Year(Now()), 1, 1);
}

/* LastDayOfTheYear() must be used in conjunction with FirstDayOfTheYear() */
function LastDayOfTheYear() {
	return DateAdd("yyyy", 1, DateAdd("d", -1,  FirstDayOfTheYear()));
}

</cfscript>