Creating Date Time Objects

Some date functions require that date time objects be passed to them, even if a complete date time object is not needed. For example, DaysInMonth(), which returns the numbers of days in a specified month, needs to just know the month and year to perform the calculation, and yet the function takes a complete date time object. So how to create a date time object on demand? The simplest way to do this is with the CreateDate() function – in this example specify the year and month as needed, and 1 for the day value. (Applies to: ColdFusion All)

Leave a Reply