|
Hi everyone
This ISO-8601 is sending me up the wall
This is what I am presently running
WITH ts
AS (
SELECT CHAR(CURRENT TIMESTAMP) AS iso_Zdate_col
FROM sysibm.sysdummy1
)
SELECT LEFT(iso_Zdate_col, 10)
CONCAT 'T' CONCAT REPLACE(SUBSTR(iso_Zdate_col, 12, 8), ':',
'.')
CONCAT (CASE WHEN CURRENT timezone < 0 THEN '-' ELSE '+' END)
CONCAT SUBSTR(DIGITS(CURRENT TIMEZONE), 1, 2) CONCAT ':'
CONCAT
SUBSTR(DIGITS(CURRENT TIMEZONE), 3, 2)
FROM ts
And I get this displayed in STRSQl
2020-01-02T12.09.34-05:00
But I have been told this is wrong
It SHOULD be
2020-01-02T12:09:34-05:00
Colons in the time part instead of periods (fullstops for the UK)
No problem - I thought - let me change the time format in my session
attributes
I changed it fo *HMS and the time separator became :
Excellent - thinks I
It makes no difference
The response in my SQL script above remains unchanged
2020-01-02T12.12.47-05:00
STILL periods (fullstops for the UK)
@#&*(^()@! Thinks I
Anyone know what I am missing?
As always - all answers gratefully accepted
Alan Shore
E-mail : ASHORE@xxxxxxxx
Phone [O] : (631) 200-5019
Phone [C] : (631) 880-8640
‘If you're going through hell, keep going.’
Winston Churchill
-----Original Message-----
From: Alan Shore
Sent: Monday, December 23, 2019 2:36 PM
To: Kevin Bucknum <Kevin@xxxxxxxxxxxxxxxxxxx>; Midrange Systems Technical
Discussion <midrange-l@xxxxxxxxxxxxxxxxxx>
Subject: RE: Timestamp in ISO-8601 compliant format
You are correct
I reran my program in debug mode - then I realized I was looking at
HLDDATE BEFORE it became populated - in the SQL I hate Mondays
Alan Shore
E-mail : ASHORE@xxxxxxxx
Phone [O] : (631) 200-5019
Phone [C] : (631) 880-8640
‘If you're going through hell, keep going.’
Winston Churchill
-----Original Message-----
From: Kevin Bucknum [mailto:Kevin@xxxxxxxxxxxxxxxxxxx]
Sent: Monday, December 23, 2019 2:28 PM
To: Midrange Systems Technical Discussion <midrange-l@xxxxxxxxxxxxxxxxxx>
Cc: Alan Shore <ashore@xxxxxxxx>
Subject: [EXTERNAL] RE: Timestamp in ISO-8601 compliant format
Works fine for me at 7.3. Just a note - that is the version that assumes
you are in GMT.
**FREE
Dcl-s Hlddate Char(25);
Exec Sql
WITH ts AS (
SELECT CHAR(TIMESTAMP(NOW())) AS iso_Zdate_col
FROM sysibm.sysdummy1
)
SELECT LEFT(iso_Zdate_col, 10) CONCAT 'T' CONCAT
REPLACE(SUBSTR(iso_Zdate_col, 12, 8), ':', '.')
CONCAT '+00:00' into :Hlddate
FROM ts;
Dsply Hlddate;
*Inlr = *On;
Return;
-----Original Message-----
From: MIDRANGE-L [mailto:midrange-l-bounces@xxxxxxxxxxxxxxxxxx] On Behalf
Of Alan Shore via MIDRANGE-L
Sent: Monday, December 23, 2019 1:11 PM
To: Midrange Systems Technical Discussion <midrange-l@xxxxxxxxxxxxxxxxxx>
Cc: Alan Shore <ashore@xxxxxxxx>
Subject: RE: Timestamp in ISO-8601 compliant format
Hi
Is it possible to embed this into an RPG program?
I tried the following - but HLDDATE remained empty
WITH ts AS (
SELECT CHAR(TIMESTAMP(NOW())) AS iso_Zdate_col
FROM sysibm.sysdummy1
)
SELECT LEFT(iso_Zdate_col, 10) CONCAT 'T' CONCAT
REPLACE(SUBSTR(iso_Zdate_col, 12, 8), ':', '.')
CONCAT '+00:00' into :Hlddate
FROM ts;
I then tried
WITH ts AS (
SELECT CHAR(TIMESTAMP(NOW())) AS iso_Zdate_col
FROM sysibm.sysdummy1
)
SELECT LEFT(iso_Zdate_col, 10) CONCAT 'T' CONCAT
REPLACE(SUBSTR(iso_Zdate_col, 12, 8), ':', '.')
CONCAT '+00:00'
FROM ts into :Hlddate;
But it would not compile
Alan Shore
E-mail : ASHORE@xxxxxxxx
Phone [O] : (631) 200-5019
Phone [C] : (631) 880-8640
‘If you're going through hell, keep going.’
Winston Churchill
-----Original Message-----
From: MIDRANGE-L [mailto:midrange-l-bounces@xxxxxxxxxxxxxxxxxx] On Behalf
Of Kevin Bucknum
Sent: Friday, December 20, 2019 1:52 PM
To: Midrange Systems Technical Discussion <midrange-l@xxxxxxxxxxxxxxxxxx>
Subject: [EXTERNAL] RE: Timestamp in ISO-8601 compliant format
It does. That’s why I said it would be up to you to calculate the offset.
You could do several things. This assumes you are to the left of GMT.
WITH ts AS (
SELECT CHAR(current timestamp - current timezone) AS iso_Zdate_col
FROM sysibm.sysdummy1
)
SELECT LEFT(iso_Zdate_col, 10) CONCAT 'T' CONCAT
REPLACE(SUBSTR(iso_Zdate_col, 12, 8), ':', '.')
CONCAT '+00:00'
FROM ts;
WITH ts AS (
SELECT CHAR(CURRENT TIMESTAMP) AS iso_Zdate_col
FROM sysibm.sysdummy1
)
SELECT LEFT(iso_Zdate_col, 10) CONCAT 'T' CONCAT
REPLACE(SUBSTR(iso_Zdate_col, 12, 8), ':', '.')
CONCAT '+' CONCAT SUBSTR(DIGITS(CURRENT TIMEZONE), 1, 2)
CONCAT ':' CONCAT
SUBSTR(DIGITS(CURRENT TIMEZONE), 3, 2)
FROM ts;
But to me the real solution is for IBM to implement your RFE.
-----Original Message-----
From: MIDRANGE-L [mailto:midrange-l-bounces@xxxxxxxxxxxxxxxxxx] On Behalf
Of Rob Berendt
Sent: Friday, December 20, 2019 12:06 PM
To: Midrange Systems Technical Discussion <midrange-l@xxxxxxxxxxxxxxxxxx>
Subject: RE: Timestamp in ISO-8601 compliant format
Isn't that assuming that you are at GMT?
Rob Berendt
--
IBM Certified System Administrator - IBM i 6.1 Group Dekko Dept 1600 Mail
to: 2505 Dekko Drive
Garrett, IN 46738
Ship to: Dock 108
6928N 400E
Kendallville, IN 46755
http://www.dekko.com
-----Original Message-----
From: MIDRANGE-L <midrange-l-bounces@xxxxxxxxxxxxxxxxxx> On Behalf Of
Kevin Bucknum
Sent: Friday, December 20, 2019 12:38 PM
To: Midrange Systems Technical Discussion <midrange-l@xxxxxxxxxxxxxxxxxx>
Subject: RE: Timestamp in ISO-8601 compliant format
CAUTION: This email originated from outside of the organization. Do not
click links or open attachments unless you recognize the sender and know
the content is safe.
Chuck was showing several things in that post. I always had to read his
replies several times, but almost always picked up something new. He does
show how to create most of the pieces you are looking for. I will leave it
up to you to determine the offset, but something like this based on his
response.
WITH ts AS (
SELECT CHAR(TIMESTAMP(NOW())) AS iso_Zdate_col
FROM sysibm.sysdummy1
)
SELECT LEFT(iso_Zdate_col, 10) CONCAT 'T' CONCAT
REPLACE(SUBSTR(iso_Zdate_col, 12, 8), ':', '.')
CONCAT '+00:00'
FROM ts;
That will give you something like this: 2019-12-20T11.37.46+00:00
-----Original Message-----
From: MIDRANGE-L [mailto:midrange-l-bounces@xxxxxxxxxxxxxxxxxx] On Behalf
Of Alan Shore via MIDRANGE-L
Sent: Friday, December 20, 2019 11:03 AM
To: Midrange Systems Technical Discussion <midrange-l@xxxxxxxxxxxxxxxxxx>
Cc: Alan Shore <ashore@xxxxxxxx>
Subject: RE: Timestamp in ISO-8601 compliant format
Thanks for the reply Rob
Unfortunately - that thread is going the other way (unless I missed it) -
extracting a time stamp from an ISO-8601 format
Alan Shore
E-mail : ASHORE@xxxxxxxx
Phone [O] : (631) 200-5019
Phone [C] : (631) 880-8640
'If you're going through hell, keep going.'
Winston Churchill
-----Original Message-----
From: MIDRANGE-L [mailto:midrange-l-bounces@xxxxxxxxxxxxxxxxxx] On Behalf
Of Rob Berendt
Sent: Friday, December 20, 2019 12:00 PM
To: Midrange Systems Technical Discussion <midrange-l@xxxxxxxxxxxxxxxxxx>
Subject: [EXTERNAL] RE: Timestamp in ISO-8601 compliant format
See this thread
https://archive.midrange.com/midrange-l/201803/msg00698.html
Rob Berendt
--
IBM Certified System Administrator - IBM i 6.1 Group Dekko Dept 1600 Mail
to: 2505 Dekko Drive
Garrett, IN 46738
Ship to: Dock 108
6928N 400E
Kendallville, IN 46755
http://www.dekko.com
-----Original Message-----
From: MIDRANGE-L <midrange-l-bounces@xxxxxxxxxxxxxxxxxx> On Behalf Of
Alan Shore via MIDRANGE-L
Sent: Friday, December 20, 2019 11:52 AM
To: midrange-l@xxxxxxxxxxxxxxxxxx
Cc: Alan Shore <ashore@xxxxxxxx>
Subject: Timestamp in ISO-8601 compliant format
CAUTION: This email originated from outside of the organization. Do not
click links or open attachments unless you recognize the sender and know
the content is safe.
Hi everyone
Before I forget - we are on V7r3
I am doing a google search - but the number of responses is HUGE Is there
anything available in RPG or SQL for that matter that can give me the time
stamp ISO-8601 format This is an example of what I am talking about
"2012-04-23T18:25:43.511+00:00"
As always - all replies gratefully accepted
Alan Shore
E-mail : ASHORE@xxxxxxxx<mailto:ASHORE@xxxxxxxx>
Phone [O] : (631) 200-5019
Phone [C] : (631) 880-8640
'If you're going through hell, keep going.'
Winston Churchill
--
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
[https://www.medtronsoftware.com/img/MedtronMinilogo.bmp] Kevin Bucknum
Senior Programmer Analyst
MEDDATA / MEDTRON
120 Innwood Drive
Covington LA 70433
Local: 985-893-2550
Toll Free: 877-893-2550
https://www.medtronsoftware.com
CONFIDENTIALITY NOTICE
This document and any accompanying this email transmission contain
confidential information, belonging to the sender that is legally
privileged. This information is intended only for the use of the
individual or entity named above. The authorized recipient of this
information is prohibited from disclosing this information to any other
party and is required to destroy the information after its stated need has
been fulfilled. If you are not the intended recipient, or the employee of
agent responsible to deliver it to the intended recipient, you are hereby
notified that any disclosure, copying, distribution or action taken in
reliance on the contents of these documents is STRICTLY PROHIBITED. If you
have received this email in error, please notify the sender immediately to
arrange for return or destruction of these documents.
--
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
[https://www.medtronsoftware.com/img/MedtronMinilogo.bmp] Kevin Bucknum
Senior Programmer Analyst
MEDDATA / MEDTRON
120 Innwood Drive
Covington LA 70433
Local: 985-893-2550
Toll Free: 877-893-2550
https://www.medtronsoftware.com
CONFIDENTIALITY NOTICE
This document and any accompanying this email transmission contain
confidential information, belonging to the sender that is legally
privileged. This information is intended only for the use of the
individual or entity named above. The authorized recipient of this
information is prohibited from disclosing this information to any other
party and is required to destroy the information after its stated need has
been fulfilled. If you are not the intended recipient, or the employee of
agent responsible to deliver it to the intended recipient, you are hereby
notified that any disclosure, copying, distribution or action taken in
reliance on the contents of these documents is STRICTLY PROHIBITED. If you
have received this email in error, please notify the sender immediately to
arrange for return or destruction of these documents.
--
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
[https://www.medtronsoftware.com/img/MedtronMinilogo.bmp] Kevin Bucknum
Senior Programmer Analyst
MEDDATA / MEDTRON
120 Innwood Drive
Covington LA 70433
Local: 985-893-2550
Toll Free: 877-893-2550
https://www.medtronsoftware.com
CONFIDENTIALITY NOTICE
This document and any accompanying this email transmission contain
confidential information, belonging to the sender that is legally
privileged. This information is intended only for the use of the
individual or entity named above. The authorized recipient of this
information is prohibited from disclosing this information to any other
party and is required to destroy the information after its stated need has
been fulfilled. If you are not the intended recipient, or the employee of
agent responsible to deliver it to the intended recipient, you are hereby
notified that any disclosure, copying, distribution or action taken in
reliance on the contents of these documents is STRICTLY PROHIBITED. If you
have received this email in error, please notify the sender immediately to
arrange for return or destruction of these documents.
--
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.
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.