Whatever message this page gives is out now! Go check it out!

FirstDayOfMonth

Last update:
May 18, 2026

Description

Determines the ordinal (day number, in the year) of the first day of the month in which a given date falls.

Returns

A number that corresponds to a day-number in a year.

Category

Function syntax

FirstDayOfMonth(date)

See also

Parameters

Parameter
Description
date
Date/time object, in the range 100 AD–9999 AD.

Usage

When passing a date/time value as a string, enclose it in quotation marks. Otherwise, it is interpreted as a number representation of a date/time object.

Example

<cfscript>
    Date1 = "{ts '2018-12-06 12:13:50'}";
    FirstDayOfMonth= FirstDayOfMonth(Date1)
    year = (Date1)
    writeOutput("The first day of month in " & year & "<br/>")
    writeOutput("falls on day number " & FirstDayOfMonth)
</cfscript>
Output
The first day of month in {ts '2018-12-06 12:13:50'}

falls on day number 335

Share this page

Was this page helpful?
We're glad. Tell us how this page helped.
We're sorry. Can you tell us what didn't work for you?
Thank you for your feedback. Your response will help improve this page.

On this page