As noted, you should be checking for validity BEFORE doing any conversion, the goal being to ensure that the conversion will work properly. The IsValid() function expects a string as its input so that isn't really working like you think it is.
-craig
"You can never have too many knives" -- Logan Nine Fingers
We would have to convert to timestamp before checking for validity of timestamp. We cannot check for timestamp validity without the string being a timestamp. I tested with an invalid string and the conversion fails and consequently the validity fails and 0 is returned as is the intended purpose.
Last edited by ssnegi on Wed Feb 26, 2014 5:15 pm, edited 1 time in total.
Well it doesnt make any difference if we do the conversion before or after the validity. I tested with the conversion before validity and it works correctly.
I tested string given by you...2013-02-27T03:13:14...The job output 0. It only gave a warning for validity.
APT_CombinedOperatorController,0: Data string '2013-02-27T03:13:14' does not match format '%yyyy-%mm-%dd %hh:%nn:%ss.3': missing the fractional part of the field expected by tag %ss.3.
I also tested 2013-02-41 03:13:14.000 with DD=41 and it output 0 without warning.
If you test a string for validity FIRST and then convert only valid values, you would not receive warnings like that... which is the whole point of testing validity first.
srini.dw: did you get this working for you? Remove the StringToTimestamp from your code and for the "then" do whatever substring / conversion you need to populate the target field. For the "else" set it to whatever it should be if the validity check fails - zero, null, the original field value, whatever.
-craig
"You can never have too many knives" -- Logan Nine Fingers