MVSFORUMS.com A Community of and for MVS Professionals
NASCAR9 Intermediate Joined: 08 Oct 2004 Posts: 267 Topics: 50 Location: California
Posted: Wed Jul 26, 2017 6:42 pm Post subject: New Formatting Functions in DB2
The forum has been slow so I figured I post something.
Just came across this function:
Read up on it, it's powerful. Many more formats available.
I use to do this:
Now I do this:
kolusu Site Admin Joined: 26 Nov 2002 Posts: 11813 Topics: 74 Location: San Jose
Posted: Thu Jul 27, 2017 1:01 pm Post subject:
Thanks for sharing. I would prefer using TO_CHAR instead of Varchar format as it would give you extra 2 bytes for length.
SELECT TO_CHAR(CURRENT DATE,'YYYYMMDD')
SELECT TO_CHAR(CURRENT DATE,'MMDDYYYY')
SELECT TO_CHAR(CURRENT DATE,'DD-MON-YYYY')
You can also format the numbers with comma's as shown in this topic
https://www.mvsforums.com/helpboards/viewtopic.php?t=12393 _________________ Kolusu - DFSORT Development Team (IBM)
DFSORT is on the Web at:
All times are GMT - 5 Hours
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum