Skip to Content
0
Former Member
Mar 31, 2010 at 06:48 PM

Date Conversion

24 Views

Hi

Appointment Dates in our DB are saved as Numbers and I'm using Crystal XI to convert them to date format in a formula @Appt date.

@Apptdate

Function (numberVar v2)

local stringvar str;

str:=totext(v2,0,"");

local stringvar dd:=right(str,2);

local stringvar mm:=mid(str,5,2);

local stringvar yy:=left(str,4);

date(tonumber(yy),tonumber(mm),tonumber(dd));

When I use this formula in the report the format is as Month/Day/Year. There is another formula which compares the @apptdate to see if they fall in a specific time period (eg Last month) for which the formula is

{@Appt Date} >= dateserial(year(currentdate),month(currentdate)-1,1) and

{@Appt Date} <= dateserial(year(currentdate),month(currentdate),1)-1

Could someone tell me how this is calculating since the @Apptdate format is Month/Day/Year whereas the Dateserial is Year, Month.

Any help is greatly appreciated.

Thanks

Edited by: achett13 on Mar 31, 2010 8:48 PM

Edited by: achett13 on Mar 31, 2010 8:49 PM