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!

Convert Date/Time field to DateVar 1

Status
Not open for further replies.

ccanalia

Technical User
Jul 27, 2004
20
0
0
US
I am currently writing a report in Crystal 10 and I am using a formula to get statistics for our support site on how long a ticket is open. This is a SQL Database.
I am using this formula and I am assuming that it is not working because my date field isnt in DateVar format.


WhileReadingRecords;
Local DateVar Start := {Cases.CreateDate};
Local DateVar End := {Cases.UpdateDate};
Local NumberVar Weeks;
Local NumberVar Days;
Local Numbervar Hol;
DateVar Array Holidays;

Weeks:= (Truncate (End - dayofWeek(End) + 1
- (Start - dayofWeek(Start) + 1)) /7 ) * 5;
Days := DayOfWeek(End) - DayOfWeek(Start) + 1 +
(if DayOfWeek(Start) = 1 then -1 else 0) +
(if DayOfWeek(End) = 7 then -1 else 0);

Local NumberVar i;
For i := 1 to Count (Holidays)
do (if Holidays in start to end then Hol:=Hol+1 );

Weeks + Days - Hol

BeforeReadingRecords;
DateVar Array Holidays := [
Date (2004,12,24),
Date (2005,01,03),
Date (2004,11,25),
Date (2004,11,26)
];
0

Is there a formula that I can use to change the {Cases.CreateDate} from a Date/Time to a DateVar?

Thanks,

Chris

 
To convert use:

Local DateVar Start := cdate({Cases.CreateDate});
Local DateVar End := cdate({Cases.UpdateDate});

-k
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top