please help me!!!!!!!

if someone can give me advice on this i would be very happy.
I want ot write a program thatincrements the date.When the user clicks on the button (whose caption should be "Increment Date" , the program must increment the date.For example ,if the date in the Edit component is 20/11/2011 it should be changed to21/11/2011.If the date 30/11/2001 it should be changed to01/01/2012.the program should also take the leap years into account.So if the date is 28/02/2012,it should be changed 29/02/2012,and this should be changed to 01/03/2012 if the button is clicked again.
I hope this makes sense!!!.
Please help if someone can.
Thanx
O before I forget i want to test whether a year is a leap year by using the following function

function LeapYear (YearNum : Integer) : Boolean;
begin
LeapYear := False;
if ((YearNum MOD 4 = 0) and (YearNum MOD 100 <> 0)) or
(YearNum MOD 400 = 0) then
LeapYear := True;
end;

Thanx again
J.

Comments

  • : if someone can give me advice on this i would be very happy.
    : I want ot write a program thatincrements the date.When the user clicks on the button (whose caption should be "Increment Date" , the program must increment the date.For example ,if the date in the Edit component is 20/11/2011 it should be changed to21/11/2011.If the date 30/11/2001 it should be changed to01/01/2012.the program should also take the leap years into account.So if the date is 28/02/2012,it should be changed 29/02/2012,and this should be changed to 01/03/2012 if the button is clicked again.
    : I hope this makes sense!!!.
    : Please help if someone can.
    : Thanx
    : O before I forget i want to test whether a year is a leap year by using the following function
    :
    : function LeapYear (YearNum : Integer) : Boolean;
    : begin
    : LeapYear := False;
    : if ((YearNum MOD 4 = 0) and (YearNum MOD 100 <> 0)) or
    : (YearNum MOD 400 = 0) then
    : LeapYear := True;
    : end;
    :
    : Thanx again
    : J.
    :
    :
    I suggest that you use StrToDate() to change the date into a TDateTime variable. Then you can simply add 1 to that variable and change it back to a string using DateToStr(). See the online help for more information.
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

In this Discussion