On Tue, 8 Oct 2024 at 18:26, Art Tostaine, Jr.wrote:
We are receiving a tab delimited file from a partner with dates like
10/5/24. I'm storing it in an alpha field.
I tried converting to *ISO using %DATE(mydate:*MDY) and it fails in the
monitor loop.
Hi Art,
*MDY expects 8 characters
https://www.ibm.com/docs/en/i/7.5?topic=formats-date-data-type#ddate
SQL is a little less strict. I'm away from a compiler right now, but
the manual says that TIMESTAMP_FORMAT should work
https://www.ibm.com/docs/en/i/7.5?topic=functions-timestamp-format
'A substring of the string-expression representing a component of a
date or timestamp (such as year, month, day, hour, minutes, seconds)
can include less than the maximum number of digits for that component
of the date or timestamp. Any missing digits default to zero. For
example, with a format-string of 'YYYY-MM-DD HH24:MI:SS', an input
value of '999-3-9 5:7:2' would produce the same result as '0999-03-09
05:07:02'.'
So maybe:
incomingChar = '10/5/24';
exec sql
values date(timestamp_format(:incomingChar, 'MM/DD/RRRR')) into :ISODate;
--buck
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2025 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.