jmd0252
Programmer
- May 15, 2003
- 667
OK I found the formula to calculate a person's age,, using a field that is defined as a date. But I have a field that is defined as a string,, how can I conver it to a date?? my sting has 20080101,, for it's value,, for example this is the formula I am trying to figure out,,
DateValue ({PM_EMPMASTER.BIRTH_DATE});
DateVar Birth:= {PM_EMPMASTER.BIRTH_DATE};
DateVar Ann := CurrentDate;
if (Month(Ann) * 100) + Day (Ann) >=(Month(Birth) *100) + Day (Birth)
then Year (Ann) - Year(Birth)
else Year (Ann) - Year(Birth) -1
but line 2 kicks with the message it has to be a date,, so what have I done wrong????
bear with me boys and girls,, I am just learning crystal
thanks,, for any and all help
DateValue ({PM_EMPMASTER.BIRTH_DATE});
DateVar Birth:= {PM_EMPMASTER.BIRTH_DATE};
DateVar Ann := CurrentDate;
if (Month(Ann) * 100) + Day (Ann) >=(Month(Birth) *100) + Day (Birth)
then Year (Ann) - Year(Birth)
else Year (Ann) - Year(Birth) -1
but line 2 kicks with the message it has to be a date,, so what have I done wrong????
bear with me boys and girls,, I am just learning crystal
thanks,, for any and all help