DanTheDane
245 pts. | Sep 7 2009 1:23PM GMT
Phil,
As far as I can see, your code leaves me with a char field; - what is need is a date-field that can be used in dta-calcs.
Thanks for your interest.
Dan
DanTheDane
245 pts. | Sep 7 2009 2:33PM GMT
hi Carlosdl,
I’m using an IBM Power 6 System i, so opsys is OS/400
Dan
Philpl1jb
24610 pts. | Sep 7 2009 2:53PM GMT
You were doing SQL
with a numeric field mydt80
you
1. convert it to char — char(mydt80)
2. get substrings to build ccyy-mm-dd
3. do a date(isodatestring,ISO)
to get a date. Sorry, don’t have a computer today.
Date(substr(char(mydt80).1.4) || ‘-’||
substr(char(mydt80).5.2) || ‘-’||
substr(char(mydt80).7.2) , ISO)
Phil
Philpl1jb
24610 pts. | Sep 7 2009 8:55PM GMT
convert(datetime, @datestring, 114)
is great but I don’t think it’s available in AS/400 SQL
Phil
Kccrosser
1850 pts. | Sep 8 2009 6:52PM GMT
Check the following link for discussions on date/time conversions in DB2. Unfortunately, it doesn’t have an equivalent to the SQL Convert/Cast functions for date/time, so you will need to write one. The page at the link discusses these in detail and gives some example functions.






