Help - Need date conversion
I am trying to convert a numeric field of data from a number to a date format so that I can filter by the date. As an example, my date comes in to Crystal as an 8 digit number. ex. 02062012. I need to convert that to a date field, preferably 02/06/2012 or with dots. Makes no difference. What I need to be able to do in the end is to run reports that I can then filter by date. Essentially I need an aging report, but I can't seem to figure out the right formula.
Please help!
thanks,
Jason
Re: Help - Need date conversion
Welcome to CodeGuru forums!
1.- Convert numericfield to string field
2.- Apply Date function giving year, month and day in numeric way
Code:
StringVar DateString := ToText({YourTable.YourNumericField},"00000000");
DateVar DateDate := Date(ToNumber(Mid(DateString,5,4)), ToNumber(Mid(DateString,1,2)), ToNumber(Mid(DateString,3,2)));
DateDate;
(DateString & DateDate are variable's names, could be whichever you like)