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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Modifying a Date Field 1

Status
Not open for further replies.

Mighty

Programmer
Feb 22, 2001
1,682
US
How do I add a number of days/months/years to a date field.

e.g. in Access I can do the following:

Update [MyTable] set [mydate] = dateAdd('m', 2, [mydate])

This will add 2 months to all the [mydate] values.

How do I do something similar in Pervasive??

Mighty
 
Hi,

I got this from the manual - hopefully it will help.

Regards,
Tom

Date Arithmetic
The SRDE supports adding or subtracting an integer from a date where the integer is the number of days to add or subtract, and the date is embedded in a vendor string. (This is equivalent to executing a convert on the date).

The SRDE also supports subtracting one date from another to yield a number of days.

Examples
SELECT * FROM person P, Class C WHERE p.Date_Of_Birth < ' 1973-09-05' and c.Start_date >{d '1995-05-08'} + 30
 
Thanks Tom - although I didn't need the convert on the date.

I simply did something like the following the following:

UPDATE "My Table" SET myDate = myDate + 365

Mighty
 
Hi,

Glad I could help. Thanks for the star.

Regards,
Tom

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top