An alternative is how are you seeing a file with MMDDYY? If you are using one of the IBM commands with OUTPUT(*OUTFILE) then I suggest using one of the SQL services instead as they will use real date and time fields.
-----Original Message-----
From: MIDRANGE-L <midrange-l-bounces@xxxxxxxxxxxxxxxxxx> On Behalf Of Therrien, Paul via MIDRANGE-L
Sent: Tuesday, March 26, 2019 11:29 AM
To: 'Midrange Systems Technical Discussion' <midrange-l@xxxxxxxxxxxxxxxxxx>
Cc: Therrien, Paul <ptherrien@xxxxxxxxxxx>
Subject: RE: SQL string to date conversion
+1
I like the 1st one.
-----Original Message-----
From: MIDRANGE-L [mailto:midrange-l-bounces@xxxxxxxxxxxxxxxxxx] On Behalf Of Birgitta Hauser
Sent: Tuesday, March 26, 2019 11:26 AM
To: 'Midrange Systems Technical Discussion' <midrange-l@xxxxxxxxxxxxxxxxxx>
Subject: RE: SQL string to date conversion
Convert a character date format MMDDYY into a real date, here 2 solutions
Date(Timestamp_Format(YourMDY, 'MMDDYY') Date('20' concat Right(YourMDY, 2) concat Left(YourMDY, 4) concat '000000')
Mit freundlichen Grüßen / Best regards
Birgitta Hauser
"Shoot for the moon, even if you miss, you'll land among the stars." (Les
Brown)
"If you think education is expensive, try ignorance." (Derek Bok) "What is worse than training your staff and losing them? Not training them and keeping them!"
"Train people well enough so they can leave, treat them well enough so they don't want to." (Richard Branson)
-----Original Message-----
From: MIDRANGE-L <midrange-l-bounces@xxxxxxxxxxxxxxxxxx> On Behalf Of T.
Adair
Sent: Dienstag, 26. März 2019 16:00
To: midrange-l@xxxxxxxxxxxxxxxxxx
Subject: SQL string to date conversion
THIS CAN'T BE THIS HARD!!! Am I just having a massive brain-cramp? I simply want to take a 6-character field (MMDDYY) and convert it to date format in SQL. I've tried various ways using cast(), I've tried various ways using convert(). I've Gaagled it and I've searched the archives, and I've still not found a solution.
We are on 7.2 and no, we're not current on PTFs. The 6-character "date"
field is coming directly from DSPOBJD.
There are other ways to get around this (example - substringing the character field) but this has infuriated me and I refuse to surrender!
This has to be something simple that I'm just missing! Somebody please put me out of my misery!
Thanks in advance, and please forgive my rant.
~TA~
--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list To post a message email: MIDRANGE-L@xxxxxxxxxxxxxxxxxx To subscribe, unsubscribe, or change list options,
visit:
https://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives at
https://archive.midrange.com/midrange-l.
Please contact support@xxxxxxxxxxxx for any subscription related questions.
Help support midrange.com by shopping at amazon.com with our affiliate link:
https://amazon.midrange.com
--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list To post a message email: MIDRANGE-L@xxxxxxxxxxxxxxxxxx To subscribe, unsubscribe, or change list options,
visit:
https://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives at
https://archive.midrange.com/midrange-l.
Please contact support@xxxxxxxxxxxx for any subscription related questions.
Help support midrange.com by shopping at amazon.com with our affiliate link:
https://amazon.midrange.com
--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list To post a message email: MIDRANGE-L@xxxxxxxxxxxxxxxxxx To subscribe, unsubscribe, or change list options,
visit:
https://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives at
https://archive.midrange.com/midrange-l.
Please contact support@xxxxxxxxxxxx for any subscription related questions.
Help support midrange.com by shopping at amazon.com with our affiliate link:
https://amazon.midrange.com
As an Amazon Associate we earn from qualifying purchases.