Quantcast
Channel: Microsoft SQL Server
Viewing all articles
Browse latest Browse all 4871

DB2 SQL fun with date and times

$
0
0

The system is very picky and requires the XML element to display the date and time like this:

< CreatedDateTime >2018-02-15T17:30Z

The time must be in UTC format and contain that T before the time and that Z after the time.

My DB2 SQL has this:

SQL
VARCHAR_FORMAT(CURRENTTIMESTAMP-CURRENTTIMEZONE,'YYYY-MM-DDHH:MI')asCREATEDDATETIME


It would work except for the T and the Z. We've tried to hard code in these characters like:

SQL
,VARCHAR_FORMAT(CURRENTTIMESTAMP-CURRENTTIMEZONE,'YYYY-MM-DD, 'T',HH:MI','Z')asCREATEDDATETIME

But the VARCHAR_FORMAT() doesn't like those characters.

Any suggestions?


Viewing all articles
Browse latest Browse all 4871

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>