#### Howdy, Stranger!

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

#### Categories

Member Posts: 59
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!!!.
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.

• Member Posts: 6,349
: 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!!!.
: 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.
• USAMember Posts: 0

_ / http://forcoder.org / free ebooks and video tutorials about / Perl, C, Go, C#, Objective-C, Visual Basic .NET, Visual Basic, PL/SQL, Ruby, MATLAB, JavaScript, Python, Scratch, Java, PHP, R, Swift, Assembly, C++, Delphi D, VBScript, Crystal, Fortran, Scheme, Kotlin, COBOL, Awk, F#, Lua, Apex, FoxPro, Prolog, Julia, Ada, Hack, Scala, Clojure, SAS, ML, Erlang, Transact-SQL, Rust, Bash, Lisp, Alice, Logo, Dart, LabVIEW, ABAP / ________