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

Adding a date field with number of days

Status
Not open for further replies.

kkey

IS-IT--Management
Jul 1, 2004
2
US
I have 3 fields:
1. Date_field
2. Unit_field ( "D" = day, "M" = Month)
3. Length_field (number)

(If Unit_field = "M" and
Length_field = "1" then (length_field * 30) will give me the "number of days".

I want to take the "number of days" and add it to the Date_field.
Example:
Date_field = date (2004, 07, 01)
Unit_field = "M"
Length_field = "2"
Therefore, I want to add 60 days to 07-01-04
How can this be done with a formula.


 
Try something like:

if {table.unit} = "M" then
dateadd("d",{table.length}*30,{table.date}) else
if {table.unit} = "D" then
dateadd("d",{table.length},{table.date})

This assumes that {table.length} is the number of days when {table.unit} = "D".

-LB
 
Thank you lbass. The formula worked like a charm.

Your help is greatly appreciated.
kkey
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top