Converting Text to Date or DateTime

Sunday 16 November 2008 @ 9:59 pm

I maintain a list of commonly used formulas on my site and some of these formulas go back nearly 10 years. I have started to notice that some of the older formulas can be done more simply using features in the newer versions of Crystal. So I will occasionally update a formula to simplify it.

For example, one of the first formulas I wrote converts a character date into a true date. The original worked for text stored in formats such as M/D/YY or MM/DD/YYYY. The challenge back then was determining if the month or day was 1 or 2 digits and the method I used was to look for the positions of the slashes. This job is made easier now because we can use the SPLIT () function. So I have finally updated the formula. I also added formulas that convert values in “YYYYMMDDHHMMSS” or “YYYYMMDD” formats.

(For examples of my most popular formulas, please visit the FORMULAS page on my website.)

Leave a Reply

Recrystallize Pro

Crystal Reports Server