ISO Date Format Samples

SSIS Expression

(DT_WSTR, 4)YEAR(GETDATE())
+
RIGHT(“0″ + (DT_WSTR, 2)MONTH(GETDATE()), 2)
+
RIGHT(“0″ + (DT_WSTR, 2)DAY(GETDATE()), 2)

SSRS Expression

=CSTR(YEAR(Now)) + RIGHT(“0″ + CSTR(MONTH(NOW)), 2) + RIGHT(“0″ + CSTR(DAY(NOW)), 2)

DB2

SELECT REPLACE(CHAR(CURDATE(),ISO), ''-'', '''') 
FROM SYSIBM.SYSDUMMY1

SELECT CURDATE() - 3 DAYS
FROM SYSIBM.SYSDUMMY1

SELECT RTRIM(CHAR(YEAR(CURRENT DATE))) 
    || RIGHT('0' || RTRIM(CHAR(MONTH(CURRENT DATE))), 2) 
    || RIGHT('0' || RTRIM(CHAR(DAY(CURRENT DATE))), 2)
FROM SYSIBM.SYSDUMMY1

SELECT VARCHAR_FORMAT(CURRENT TIMESTAMP, 'YYYYMMDD') 
FROM SYSIBM.SYSDUMMY1

References:
http://en.wikipedia.org/wiki/ISO_8601

Advertisements