Delphi Pages Forums  

Go Back   Delphi Pages Forums > Delphi Forum > General

Lost Password?

Reply
 
Thread Tools Display Modes
  #1  
Old 03-29-2012, 08:08 AM
Zaaka Zaaka is offline
Senior Member
 
Join Date: Aug 2002
Location: Teesside, UK
Posts: 217
Default Dates & Strings

I have a date in a string in the form 29-03-2012, what is the quickest and easiest way to add a year, and compare the current date to check if the current date is a week before or after the date plust 1 year?
Reply With Quote
  #2  
Old 03-29-2012, 08:10 PM
delphimpd delphimpd is offline
Senior Member
 
Join Date: Oct 2006
Posts: 701
Default

Hi.

I am not on my desk right now. However, try the following and let us know if that worked out for you or not please.

Incdays(strtoDateTime(yourfield.text),365);

I can't remember if there is any incyear

Good Luck

Regards
Reply With Quote
  #3  
Old 03-29-2012, 09:30 PM
delphimpd delphimpd is offline
Senior Member
 
Join Date: Oct 2006
Posts: 701
Default

Quote:
Originally Posted by delphimpd View Post
Hi.

I am not on my desk right now. However, try the following and let us know if that worked out for you or not please.

Incdays(strtoDateTime(yourfield.text),365);

I can't remember if there is any incyear

Good Luck

Regards
Yes there is a incYear

IncYear(strtoDateTime(yourfield.text),1); //This will add

IncYear(strtoDateTime(yourfield.text),-1); //This will substract a Year

Good Luck

Regards
Reply With Quote
Reply

Tags
add, compare, date, year

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On

Forum Jump


All times are GMT. The time now is 05:40 AM.


Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2019, vBulletin Solutions, Inc.