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



Jeff,

Using STRSQL over a file with a Decimal (8,0) field:

SELECT DATE( (substr(digits(datenump),01,04)) || '-' ||
(substr(digits(datenump),05,02)) || '-' ||
(substr(digits(datenump),07,02)) )
FROM tlib/sqldatep

Returns:
....+....1
DATE
2014-09-09

Also works with type numeric.
******** End of data ********


-----Original Message-----
From: MIDRANGE-L [mailto:midrange-l-bounces@xxxxxxxxxxxx] On Behalf Of Jeff Young
Sent: Tuesday, September 09, 2014 10:14 AM
To: Midrange Systems Technical Discussion
Subject: Re: Converting a numeric date value to a DATE in SQL

Alan,
Unfortunately, iDate is not an option for this customer (need to get permission to install *any* 3rd party software -including- utilities) I have tried to use SELECT DATE(field) from my file (where field is 20140905), but SQL did not like that and it returned ++++++++.
Is there an easy way to do this?



Jeff Young
Sr. Programmer Analyst

On Tue, Sep 9, 2014 at 11:46 AM, John Yeung <gallium.arsenide@xxxxxxxxx>
wrote:

On Tue, Sep 9, 2014 at 10:38 AM, Jeff Young <jyoung0950@xxxxxxxxx> wrote:
Using SQL, how do I convert a numeric value of a database field in
ISO
date
format (ccyymmdd) to a DATE data type for comparison?
I need to select all records with a date that is equal to a value
input
by
the user.

I think we all agree that the "right" way to do dates is with date
fields. However, if all you need is to check for equality, probably
the fastest thing to do is to convert your input to numeric ISO and do
a direct comparison with that.

And in your case, even if you had to check for earlier-than,
later-than, or between, you could still use the numeric ISO dates
as-is (this would not be the case for MDY, USA, or EUR numeric-field
dates).

That said, it is probably still worth having iDate. :)

John Y.
--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing
list To post a message email: MIDRANGE-L@xxxxxxxxxxxx To subscribe,
unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxx Before posting, please take
a moment to review the archives at
http://archive.midrange.com/midrange-l.


--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list To post a message email: MIDRANGE-L@xxxxxxxxxxxx To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxx Before posting, please take a moment to review the archives at http://archive.midrange.com/midrange-l.


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.