Dear Moonknight,
I wrote it in CR10 which apparently has more options for instr so I didn't pick up a typo, so lets fix that first:
Let's try this:
stringvar t := '2796646:17:25:12 08-06-2005'; //replace with your field
stringvar t := Mid(t,instr(t,':')+1, length(t));
stringvar array t2 := split(t, ' ');
if length(t2[2]) = 10 and ubound(split(t2[1],':')) = 3
then
(If isdate(t2[2]) and istime(t2[1]) then
cdatetime(t2[2] & ' ' & t2[1])
else
cdate(0,0,0)
)
It would seem to me then that your field does not always have a date and time in it ... is that correct?
So we need to check for that which the above is now doing, however, it just checks for a valid date and time field, which I may not be accurate.
If the above isn't working, give me some of the formats in the field when you just place it on the report ... we need a wide variety to test for!
regards,
ro
Rosemary Lieberman
rosemary-at-microflo.com,
Microflo provides expert consulting on MagicTSD and Crystal Reports.
You will get answers more quickly if you read this before posting: faq149-3762