×
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.
On 08 Apr 2013 14:38, Stone, Joel wrote:
I would like to list the *OUTFILE of DSPOBJD by date.
Since DSPOBJD provides the incredibly ugly date format MMDDYY, I
would like to convert it to a date with year 99 going to the end of
the descending order.
What is a good method to do this?
Do I have to construct the date such as shown below?
But even then the year 99 pops to the top (it should be at the end).
I think I have to use DATE and CHAR and TRIM to build the date.
How do I force it to take MMDDYY and calc 1900 or 2000?
*MDY??
Is there a simpler, better way? <<SNIP>>
Try using the TIMESTAMP_FORMAT scalar. I am not sure if YY uses the
100-year window of the database, but I would hope so. Otherwise RR
might suffice. That should be sufficient without the ODCCEN taken into
account [until 2040 creation dates]. Otherwise a CASE expression or an
addition can easily resolve the century portion.
ORDER BY TIMESTAMP_FORMAT(ODCDAT, 'MMDDYY') DESC
http://pic.dhe.ibm.com/infocenter/iseries/v7r1m0/topic/db2/rbafzscatsformat.htm
IBM i 7.1 Information Center -> Database -> Reference -> SQL reference
-> Built-in functions -> Scalar functions
_i TIMESTAMP_FORMAT i_
"The TIMESTAMP_FORMAT function returns a timestamp Start of changethat
is based on the interpretation of the input string using the specified
formatEnd of change.
>>-TIMESTAMP_FORMAT--(--string-expression--,--format-string--)-><
..."
As an Amazon Associate we earn from qualifying purchases.
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.