Skip to content
Paul Squires edited this page Oct 19, 2026 · 3 revisions

Home › Date and Time Functions › Month

Month

Returns the month of a date serial, 1 to 12.

Syntax

Declare Function Month ( ByVal date_serial As Double ) As Long

Parameters

  • date_serial

Description

The compiler will not recognize this function unless vbcompat.bi is included.

Return Value

Returns the month number from a variable containing a date in Date Serial format.

The month values are in the range 1-12 being 1 for January and 12 for December.

Remarks

Usage

#include "vbcompat.bi"

result = Month( date_serial )

Differences from QB

  • Did not exist in QB. This function appeared in PDS and VBDOS

Examples

#include "vbcompat.bi"

Dim a As Double = DateSerial(2005,11,28) + TimeSerial(7,30,50)

Print Format(a, "yyyy/mm/dd hh:mm:ss "); Month(a)

Category: Date and Time Functions
Kind: function


Reproduced from the FreeBASIC Wiki Manual under the GNU Free Documentation License 1.3 — with no Invariant Sections, no Front-Cover Texts and no Back-Cover Texts. Copyright © the FreeBASIC project and wiki contributors. See License.

Clone this wiki locally