TIP: Click on subject to list as thread! ANSI
echo: delphi
to: DON KRAUSE
from: BRYAN SMITH
date: 1996-09-08 14:44:00
subject: Delphi Date?

On 02 Sep 96 Don Krause said to All...
 DK> I'm looking for a way, to have delphi provide a date into the future.
Remember that a TDateTime variable is really just a real number, of which
the integer part is the number of days since some obscure reference date in
the past, and the fractional part (if not 0.00) represents the time-of-day.
So to move forward by 14 days, just add 14.0, e.g.
TwoWeeksAhead := Date + 14.0 ;
If you want to move forward by some number of months or years rather than
days, you can use a TCalendar component, e.g.
Calendar1.CalendarDate := Date ;
For j := 1 to 14 do Calendar1.NextYear ;  { or Calendar1.PrevMonth etc.}
SomeFutureDate := Calendar1.CalendarDate ;
or ...
Calendar1.Year := Calendar1.Year + 14 ;
Before you say "but I don't want an ugly big calendar on my screen", please
remember that you can make the calendar component invisible !
TCalendar is not documented in the help files, but you can find the source
code in \delphi\source\samples\calendar.pas (for Delphi 1).  From that, you
can figure out all the things that a TCalendar can do for you.  For example,
it can tell you the number of days in its current month, or whether its
current year is leap.
--- PPoint 2.00
---------------
* Origin: Kingston, Canada (1:249/109.11)

SOURCE: echomail via exec-pc

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.