how can i validate if a month has 30 or 31 days and febraury havin 29 days if leap yr and 28 if not

Recommended Answers

All 2 Replies

if mnth='january' then mnthdays:=31;
if mnth='february' then begin
if (yr mod 4)=0 then mnthdays:=28
else mnthdays:=29;
end;
if mnth='march' then mnthdays:=31;
if mnth='april' then mnthdays:=30;
if mnth='may' then mnthdays:=31;
if mnth='june' then mnthdays:=30;
if mnth='july' then mnthdays:=31;
if mnth='august' then mnthdays:=31;
if mnth='september' then mnthdays:=30;
if mnth='october' then mnthdays:=31;
if mnth='november' then mnthdays:=30;
if mnth='december' then mnthdays:=31;

or you can create a record with 2 fields:month and days number.

best regards,

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.