I have a date field in string format from the input link.. values could be in format 'm/dd/yyyy' or 'mm/d/yyyy' i.e, ex: '1/28/1992'.or '01/8/1992'
I am using below function to handle it
StringtoDate(Input_Link.Column,"%m/%dd/%yyyy") but this works only for 'm/dd/yyyy' input dates
Please suggest a common way to handle this...
appending '0' in single digit date/month from source is my last option
Thanks!
handle 'm/d/yyyy' and 'mm/dd/yyyy'
Moderators: chulett, rschirm, roy
-
- Participant
- Posts: 104
- Joined: Sat Dec 24, 2005 1:26 am
- Location: Bengaluru
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
Search the Parallel Job Developer's Guide manual for "Date and Time Formats" (in Chapter 2). The part about variable forms follows the main table of string format components.
Code: Select all
"%(m,s)/%(d,s)/%yyyy"
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: 104
- Joined: Sat Dec 24, 2005 1:26 am
- Location: Bengaluru
Thanks ray, I did refered this and using this
StringtoDate(Input_Link.Column,"%(m,s)/%(d,s)/%yyyy")) this should handle single and double digits of DAY and MONTH.. but still I'm having this warning in the log
Invalid date value in getInputFieldAsDate() for field '0' of input dataset '0'.
Please suggest.
StringtoDate(Input_Link.Column,"%(m,s)/%(d,s)/%yyyy")) this should handle single and double digits of DAY and MONTH.. but still I'm having this warning in the log
Invalid date value in getInputFieldAsDate() for field '0' of input dataset '0'.
Please suggest.
As noted, sounds like you are getting bad date values. You might want to use an IsValid check before you do the conversion and only convert good dates.
Funny, saying "bad dates" always makes me think of Indiana Jones and that poor monkey. Ok, maybe not all that funny.
Funny, saying "bad dates" always makes me think of Indiana Jones and that poor monkey. Ok, maybe not all that funny.
-craig
"You can never have too many knives" -- Logan Nine Fingers
"You can never have too many knives" -- Logan Nine Fingers
If the incoming value were 12/33/2013, it should flag it as an invalid date. Try adding a reject to route the invalid date values for review.
If you anticipate an upcoming bad date, you may want to propose to meet on an invalid date.
If you anticipate an upcoming bad date, you may want to propose to meet on an invalid date.
Choose a job you love, and you will never have to work a day in your life. - Confucius
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
If your file has column headings and your Sequential File stage has "First line is column headings" set to False, the column heading itself will generate an invalid value.
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.