User Guide Cancel

FirstDayOfMonth

 

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

Date and time functions

Function syntax

FirstDayOfMonth(date)

See also

DayDayOfWeekDayOfWeekAsStringDayOfYearDaysInMonthDaysInYear

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>
<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>
<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

Get help faster and easier

New user?