Hi,
I have a situation, where i need to convert the string to date in job parameters. I am passing the date in a job parameter as '01-Jan-2012' but the parameter is defined as string. I need to extract '20120101' from this parameter and use it in the file name. Can somebody help ?
Thanks,
Vishal Gupta
I need to reformat string to date in job parameters
Moderators: chulett, rschirm, roy
-
- Participant
- Posts: 39
- Joined: Mon Feb 13, 2012 1:30 pm
-
- Participant
- Posts: 39
- Joined: Mon Feb 13, 2012 1:30 pm
Use ICONV to convert the provided date to internal format, then OCONV to convert the converted date to the format you desire.
should work, given the source and desired results you provided.
Regards,
Code: Select all
Convert("/","",OCONV(ICONV(DateParameter,"D-"),"D/YMD[4,2,2]"))
Regards,
- james wiles
All generalizations are false, including this one - Mark Twain.
All generalizations are false, including this one - Mark Twain.
Code: Select all
OCONV(ICONV(DateParameter,"D-"),"DYMD[4'',2'',2'']"))
Regarding OP, why all the different date string formats? Consistency through your jobs would be easier (I can understand potential differences from sources but with parameters?)
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
My preference would be:
Code: Select all
Oconv(Iconv(jpStringDate, "D"), "DYMD[4,2,2]" : @VM : "MCN")
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
-
- Participant
- Posts: 39
- Joined: Mon Feb 13, 2012 1:30 pm
Thanks! All
Thanks! all .. it worked perfectly.