Quantcast
Channel: IBM Mainframe Computers Forums
Viewing all articles
Browse latest Browse all 9405

DB2 :: RE: Get correct date and time when current time is over 12 hrs

$
0
0
Author: RahulG31
Subject: Reply to: Get correct date and time when current time is over 12 hrs
Posted: Wed Oct 19, 2016 3:10 am (GMT 5.5)

Quote:
SELECT WHEN CURRENT_TIME <= '00:59:59' THEN
CAST(VARCHAR_FORMAT(CURRENT_DATE - 1 DAY,'MM/DD/YYYY') AS CHAR(10))
||CAST('|' AS CHAR(1))
||CAST(VARCHAR_FORMAT(CURRENT_DATE - 1 DAY,'YYYY.MM.DD') AS CHAR(10))
||CAST('|' AS CHAR(1))
ELSE
CAST(VARCHAR_FORMAT(CURRENT_DATE,'MM/DD/YYYY') AS CHAR(10))
||CAST('|' AS CHAR(1))
CAST(VARCHAR_FORMAT(CURRENT_DATE,'YYYY.MM.DD') AS CHAR(10))
||CAST('|' AS CHAR(1))
END FROM SYSIBM.SYSDUMMY1) AS A,
CAST('|' AS CHAR(1)),
SUBSTR(DIGITS(COL2),9,2),
CAST('|' AS CHAR(1)),

You have a '|' before end of select and another '|' after end of select. That makes 2 continuous '|'.

.


Viewing all articles
Browse latest Browse all 9405

Trending Articles