Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Adding months to TDatetime 1

Status
Not open for further replies.

Jonah86

Programmer
Dec 11, 2003
152
0
0
US
I have an application where I need to put a date in my database that is 22 months from the date entered in the app. I'm not sure how to add months to a date in Delphi. I tried just Tdatetime + 22, and that adds days...but the number of days will never be the same, so that won't work.

Is there any way to do this?

Thanks for your help.
 
Hi,

in the sysutils unit there is a function called IncMonth:


function IncMonth(const DateTime: TDateTime; NumberOfMonths: Integer): TDateTime;


Cheers,
Daddy

-----------------------------------------------------
What You See Is What You Get
Never underestimate tha powah of tha google!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top