Link to home
Start Free TrialLog in
Avatar of hraja77
hraja77

asked on

DB2 need a function to return the return the current date in format yyyymmdd

hi,

I need to write a function which when called will return the current date in the format yyyymmdd

thanks
Avatar of Cenjoy100
Cenjoy100
Flag of India image

SELECT CHAR(CURRENT_DATE,ISO)
      ,CHAR(CURRENT_DATE,USA)
      ,CHAR(CURRENT_DATE,EUR)
      ,CHAR(CURRENT_DATE,JIS)
FROM SYSIBM.SYSDUMMY1

---Hope Helpful for you..ISO is your required format I guess.
Avatar of hraja77
hraja77

ASKER

thanks for that - how can i wrap this and create a function for the first date to be returned ?
what would the function be like and how do i call this - i could create another question for this if you want

thanks
ASKER CERTIFIED SOLUTION
Avatar of Cenjoy100
Cenjoy100
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of hraja77

ASKER

sorry i'm new to db2 - how do i now run the function from db2 command line
Avatar of hraja77

ASKER

i will raise another call for this part as i blieve you deserve more points
Ok,Fine once you created that I will put the comments for the same.
But its not difficult.
Trust me you will get it in flash :)
Avatar of hraja77

ASKER

thanks
Or best way you can go through the following link..
http://www.ibm.com/developerworks/data/library/techarticle/adamache/0109adamache.html

as it will be quite difficult to explain each and everything and it might stop your work for no reason.

TC