× 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.



This works by creating an *ISO formatted date (2005-12-05):

select date(substr(char(20051205),1,4) concat '-' 
       concat substr(char(20051205),5,2) concat '-' 
       concat substr(char(20051205),7,2)) 
from sysibm/sysdummy1 

Per the SQL reference, the only numeric conversions are allowed as the
number of days since 1/1/0001.

HTH,
Loyd

Loyd Goodbar
Senior programmer/analyst
BorgWarner
E/TS Water Valley
662-473-5713

-----Original Message-----
From: midrange-l-bounces@xxxxxxxxxxxx
[mailto:midrange-l-bounces@xxxxxxxxxxxx] On Behalf Of
michael@xxxxxxxxxxxxxxxxxx
Sent: Monday, December 05, 2005 10:49
To: Midrange Systems Technical Discussion
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 ...

Follow-Ups:

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.