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



At 08:42 08/02/2002, Loyd Goodbar wrote:
>Our ERP application uses *CYMD formatted dates (integer 7). So when we
>select a date column using SQL, it's formatted as 1,020,802 (Aug 2, 2002).
>
>Has anyone come up with SQL procedures to convert a numeric CYMD to a real
>date, and vice versa? The archives returned no results for "cymd date sql".

  NULLIF(DATE(SUBSTR(DIGITS(DECIMAL(19000000 + CymdVal,8,0)),1,4)||'-'||
   SUBSTR(DIGITS(DECIMAL(CymdVal,7,0)),4,2)||'-'||
   SUBSTR(DIGITS(DECIMAL(CymdVal,7,0)),6,2)),'1899-12-31')

  and

  DECIMAL((YEAR(DateVal)-1900)*10000 + MONTH(DateVal)*100 + DAY(DateVal),7)


Pete Hall
pbhall@ameritech.net
http://www.ameritech.net/users/pbhall/index.html



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.