Delphi Tips&Tricks News   Tips   .NET Software   VCL Software   Search   Contacts
Ultimate Pack - special offer!

Ultimate Pack  hot!
Image Editor  new!
Runtime Fusion
Form Designer
Object Inspector
Print Suite Pro
Commented Image
Delphi Toys
WinDowse
Delphi Bonus
TMS Scripter Studio
Form Designer VB
Form Designer .NET

...get more...
for Delphi.NET, C#, VB.NET
for Delphi VCL, BCB 3-6

WinAPI Online
Unix Manual Pages
MegaDetailed.NET
in3steps.com
cdtrrracks.com new!

Blogspot  greatis.blogspot.com

Get days count in month - DateTime - Tips & Tricks - Greatis Delphi Pages

Implementation of this idea so:


var
  DaysInYear: array[1..12] of Integer = 
                (31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31);
  Days, Month, Year: Word;

implementation
...
procedure TForm1.Button1Click(Sender: TObject);
begin
  Month:=StrToInt(Edit1.Text);
  Year:=StrToInt(Edit2.Text);
  if (IsLeapYear(Year)=True)and(Month=2) then
    Days:=DaysInYear[Month]+1
  else Days:=DaysInYear[Month];
  Label1.Caption:=IntToStr(Days)+' days in '+Edit2.text+' year';
end;

procedure TForm1.FormCreate(Sender: TObject);
var
  Present: TDateTime;
begin
  Present:=Now;
  DecodeDate(Present, Year, Month, Days);
  Edit1.Text:=IntToStr(Month);
  Edit2.Text:=IntToStr(Year);
end;
Related topics
Get difference between of 2 dates
Put current time to the title
Get week number of the year
Get age from date of birth

For more
Delphi Help

Download source