× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Michael, 

Something like this should give you DATE data type:

SELECT DATE(SUBSTR(F1,1,4)        CONCAT '-' 
            CONCAT SUBSTR(F1,5,2) CONCAT '-' 
            CONCAT SUBSTR(F1,7,2)) 
       AS MyDate                              
FROM QTEMP/T1 

If you want it displayed using ISO, either make sure your job runs in ISO
format or cast date back to char using ISO specifier:

SELECT CHAR(DATE(SUBSTR(F1,1,4)        CONCAT '-' 
                 CONCAT SUBSTR(F1,5,2) CONCAT '-' 
                 CONCAT SUBSTR(F1,7,2)), ISO) 
       AS MyDate
FROM QTEMP/T1

Elvis

-----Original Message-----
Subject: SQL - Cast Numeric to Date

I have an 8.0 field in a file. I want to do something like this:

Select Date(Num_Field) as Mydate...

I can see how to do it with a CAST on a character field - what do I need
to do for a numeric field in CCYYMMDD format? It's not really ISO...at
least I can't see how to specify no seperators.

Thanks...



As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.