Month - Built-in Date & Time Function¶
Purpose¶
Month returns the month from a datetime expression.
Syntax¶
Month(datetime)
Arguments¶
| Argument | Required | Description |
|---|---|---|
datetime |
Yes | Any valid datetime expression from which the month will be returned |
Returns¶
Integer
See also¶
- Date
- DateAdd
- DateDiff
- DatePart
- DateValue
- DateSerial
- Day
- Hour
- InAgedToDays
- InLast4WeeksToSunday
- InLast7Days
- InLastFullMonth
- InLastFullWeek
- InLastYearMTD
- InLastYearYTD
- InLeapYear
- Minute
- MonthName
- Now
- Second
- Time
- TimeSerial
- TimeValue
- WeekAgo
- Weekday
- WeekdayName
- Year
Example¶
// returns the month (2) of the year
Return Month("3 february 2010")
// returns the month of the order date
Return Month({orderhea.order_date})
// returns the month (2) of the constructed date via DateSerial
Return Month(DateSerial(2000,2,3))
// returns the month of the static date string
Return Month("02/03/2000")
Notes¶
- When
datecannot be converted to a datetime value, a runtime error is generated. - When
dateis passed as a string, your PC's regional settings are used for the conversion to datetime. If that fails—e.g., the month name is not in the right language—you get a runtime error.