What version of Crystal Reports? What data type is the field (numeric or string)? In converting this to a date field, you will also need to decide the basis for converting 2 digit years to 4 digit years - ie 50 to 99 converts to 1950 to 1999, 0 to 49 converts to 2000 to 2049. Malcolm Wynden
I'm for sale at
Crystal is quite happy to use just a two digit year - it just assumes that the first two digits are 00. Usually this is not a great idea is you are intending the first two digits to be 19 or 20, because the sort order does not reflect the century portion of the date. In some situations, such as employee birthdates, it is not an issue (yet).
StringVar DateTest := ToText({YourNumericField},"000000" ;
Date(Val(DateTest[1 to 2]),Val(DateTest[3 to 4]),Val(DateTest[5 to 6])) ;
will give you dates without a century value.
The follow function uses 50 as the cutoff point to determine which century value to use.
DateTo2000 ((Date(Val(DateTest[1 to 2]),Val(DateTest[3 to 4]),Val(DateTest[5 to 6]))),50 )
Malcolm Wynden
I'm for sale at
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.