Text to Date Format

R

Rita Palazzi

I have a table that receives a date in text format as YYYYMMDD. I have
parsed the data into separate columns of Year, Month, and Day
(hypothetical titles). I have basically concatenated the columns back
together in a new field to display a typical date (Month + / + Day + / +
Year). When the query is run, it actually does disply the text as a
date, but the format is still text and I need to be able to run
date-related functions. Is there a way to designate a text field that
appears as text to actually be used as a date?

Thanks!
Rita Palazzi
Senior Engineer / Global Trade Services
FedEx Express
 
M

MGFoster

Rita said:
I have a table that receives a date in text format as YYYYMMDD. I have
parsed the data into separate columns of Year, Month, and Day
(hypothetical titles). I have basically concatenated the columns back
together in a new field to display a typical date (Month + / + Day + / +
Year). When the query is run, it actually does disply the text as a
date, but the format is still text and I need to be able to run
date-related functions. Is there a way to designate a text field that
appears as text to actually be used as a date?

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Use this expression to convert the Text to DateTime:

cdate(format(date_column,"####-##-##"))

Where the "date_column" is the name of the column that holds the text
date.

The Format() function formats the date in ISO date format that can be
"understood" by the CDate() function, which then transforms the String
data type into a DateTime data type.
--
MGFoster:::mgf00 <at> earthlink <decimal-point> net
Oakland, CA (USA)

-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBRI74UIechKqOuFEgEQIZBgCcCQD037dJHM091Hnc5w0xgIYvXGQAoPuA
7mxJewTahqLy8xJc85ipKkUh
=1Enf
-----END PGP SIGNATURE-----
 
Top