ColdFusion UDF Library - FirstDayInMonth

December 16th, 2008
«« Back to ColdFusion Library

Category:
   DATE

Description:
   Determines the day of week (Monday, Tuesday, etc.) for the first day of the month within the specified date

Parameters:
  1. date (DateTime, required)
           A date


Returns:
       String

Requires:
       

Sample Use:
       

Copy to Clipboard
function FirstDayInMonth(date){
	var offset = 0;
	var loop = 0;
	for (loop = 1; loop lt Month(date); loop = IncrementValue(loop))offset = offset+DaysInMonth(CreateDate(Year(date),loop,1));
	return FirstDayOfMonth(date)-offset+DayOfWeek(CreateDate(Year(date),Month(date),1))-1;
};
// http://www.programmers.org/index.php/coldfusion-udf-library/?ckey=5&function=FirstDayInMonth
  1. No comments yet.
  1. No trackbacks yet.