Mastodon
Programmierung

DateTime: Get Number of Days in a month

Q:
How do i get how meny days there are in January 2002?
How do i do that..?
Thanks!!

A1:
NbrDays := EncodeDate(2002,2,1) – EncodeDate(2002,1,1);

A2:
The Delphi JEDI JCLDateTime.Pas unit has a DaysInMonth function:
http://www.delphi-jedi.org/Jedi:CODELIBJCL

A3:
From Delphi Sysutils.pas:

{ The MonthDays array can be used to quickly find the number of
days in a month: MonthDays[IsLeapYear(Y), M] }

[tags]Delphi, Misc, DateTime[/tags]

0 Kommentare zu “DateTime: Get Number of Days in a month

Schreibe einen Kommentar

Deine E-Mail-Adresse wird nicht veröffentlicht.