Sign in Join
FPDoc Onlineexperiment

StartOfTheMonth function

In unit DateUtils

Calculate the first day of the month, given a date in that month.

Declaration

pascal
function StartOfTheMonth(const AValue: TDateTime): TDateTime

Arguments

AValue

Date to return first of month from.

Function result

First day of month as a TDateTime value.

Description

StartOfTheMonth extracts the year and month parts of AValue and returns a TDateTime value with the date of the first day of that year and month as the StartOfAMonth function.

See also

Example: ex28

pascal
Program Example28;

{ This program demonstrates the StartOfTheMonth function }

Uses SysUtils,DateUtils;

Const
  Fmt = '"First day of this month : "dd mmmm yyyy';

Begin
  Writeln(FormatDateTime(Fmt,StartOfTheMonth(Today)));
End.

An experiment, built from development snapshots. Not the official Free Pascal or Lazarus documentation.