|
Hi Art,
It appears you have a mix of 2-digit and 4-digit years. Check the
difference in these 2 formats and their respective results:
values timestamp_format('8/9/2022 9:47','MM/DD/YYYY HH24:MI')
2022-08-09-09.47.00.000000
values timestamp_format('8/9/22 9:47','MM/DD/YYYY HH24:MI')
0022-08-09-09.47.00.000000
Documentation at
https://www.ibm.com/docs/en/i/7.3?topic=functions-timestamp-format says
"A substring of the/string-expression/representing a component of adate
ortimestamp (such as year, month, day, hour, minutes, seconds) can
include less than the maximum number of digits for that component of
thedate ortimestamp. 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'."
Maybe check for the error and try the other format?
--
*Peter Dow* /
Dow Software Services, Inc.
909 793-9050
petercdow@xxxxxxxxx
pdow@xxxxxxxxxxxxxx /
On 8/9/2022 10:42 AM, Art Tostaine, Jr. wrote:
It's not working if my time is less than 10am. For instance this one isformat?
giving SQLSTT 22007.
8/9/2022 9:47
Did I do something wrong or do I need to try a different timestamp
Thank you(Les
On Tue, Aug 9, 2022 at 12:08 PM Art Tostaine, Jr.<atostaine@xxxxxxxxx>
wrote:
Thank you. This worked for me:
exec Sql set :outTmStp = Timestamp_Format(:inTmStp,
'MM/DD/YY HH24:MI');
On Tue, Aug 9, 2022 at 10:40 AM Birgitta Hauser<Hauser@xxxxxxxxxxxxxxx>
wrote:
With SQL:
Timestamp_Format('8/3/22 10:02', 'MM/DD/YY HH24:MI'))
Mit freundlichen Grüßen / Best regards
Birgitta Hauser
Modernization – Education – Consulting on IBM i
"Shoot for the moon, even if you miss, you'll land among the stars."
themBrown)
"If you think education is expensive, try ignorance." (Derek Bok)
"What is worse than training your staff and losing them? Not training
needand 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: RPG400-L<rpg400-l-bounces@xxxxxxxxxxxxxxxxxx> On Behalf Of Art
Tostaine, Jr.
Sent: Dienstag, 9. August 2022 16:10
To: RPG programming on the IBM i (AS/400 and iSeries)
<rpg400-l@xxxxxxxxxxxxxxxxxx>
Subject: Timestamp conversion
I'm receiving a timestamp in a CSV (generated in Excel) that looks like
this:
8/3/22 10:02
Is there a way to automatically move it to a timestamp field or do I
orextract the date and time separately, etc?
Thanks
--
This is the RPG programming on IBM i (RPG400-L) mailing list To post a
message email:RPG400-L@xxxxxxxxxxxxxxxxxx To subscribe, unsubscribe,
relatedchange list options,
visit:https://lists.midrange.com/mailman/listinfo/rpg400-l
or email:RPG400-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives at
https://archive.midrange.com/rpg400-l.
Please contactsupport@xxxxxxxxxxxxxxxxxxxx for any subscription
relatedquestions.
Help support midrange.com by shopping at amazon.com with our affiliate
link:
https://amazon.midrange.com
--
This is the RPG programming on IBM i (RPG400-L) mailing list
To post a message email:RPG400-L@xxxxxxxxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit:https://lists.midrange.com/mailman/listinfo/rpg400-l
or email:RPG400-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives
athttps://archive.midrange.com/rpg400-l.
Please contactsupport@xxxxxxxxxxxxxxxxxxxx for any subscription
--questions.
Help support midrange.com by shopping at amazon.com with our affiliate
link:https://amazon.midrange.com
This is the RPG programming on IBM i (RPG400-L) mailing list
To post a message email: RPG400-L@xxxxxxxxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives
at https://archive.midrange.com/rpg400-l.
Please contact support@xxxxxxxxxxxxxxxxxxxx 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.
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.