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

Multiply a date by a number of weeks to arrive at date

Status
Not open for further replies.

mdj3366

Technical User
Aug 27, 2002
49
US
Hello - Using Crystal 11, SQL database. I have a datetime field that I would like to multiply by a number to arrive at the future date. Is this possible? Thanks in advance for any suggestions.
 
hi,

{some date} + 7 * {nbr of weeks}

Skip,
[sub]
[glasses]Just traded in my old subtlety...
for a NUANCE![tongue][/sub]
 
Hi - I did as suggested and an error was returned "the number of days is out of range". I have a formula to extract the date from a datetime field. The formula you suggested looks like this (@date) + 7 * (Employee.BenefitDuration).
 
@date appears to be a parameter. I thot you were using a date/time FIELD, not a parameter.

Skip,
[sub]
[glasses]Just traded in my old subtlety...
for a NUANCE![tongue][/sub]
 
Thanks for the prompt reply. I am using a datetime field. My formula for (@date) is date(Employee.HireDate). The formula is converting the datetime field of (Employee.HireDate) to a date field.
 
what are the contents of the @Date formula?
knowing that might be helpful.

Also, just because i am sorta OCD on these things and want to make certain the operator logic is clear, i would write the same formula you used like this: {@date} + (7 * {Employee.BenefitDuration})
 
Hi fisheromacse - the contents of the @date formula is dete({Employee.HireDate}). Thanks.
 
as long as all the values are dates, i am not seeing why Skip's formula would fail.
is it possible the field {Employee.HireDate} could have values that are invalid as dates?
that would be my first guess.

add something like this to the start of your date formula:
IF isdate({Employee.Hiredate})=TRUE then date({Employee.HireDate}) else dateserial(1900,01,01)

you can then filter out any dates that are equal to 01/01/1900 (and/or inform end users to fix the dates or whatever)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top