i have used java code in java snippet node but i am getting null values…How to resolve this?
Check below code for reference:
import java.util.;
import java.text.;
public class DateFormat1
{
public DateFormat1() throws Exception
{
String dateString = “32/01/2014”;
SimpleDateFormat dateFormat = new SimpleDateFormat(“dd/MM/yyyy”);
Date convertedDate = dateFormat.parse(dateString);
System.out.println("Converted string to date : " + convertedDate);
}
public static void main(String argv) throws Exception
{
new DateFormat1();
}
}
You’ll need to use a “lenient” mode to parse such dates. I think the String to Date&Time node has no such option. So instead you’ll have to go back to using a Java Snippet node and enable the “lenient” flag for the DateFormat:
Specify whether or not date/time parsing is to be lenient. With lenient parsing, the parser may use heuristics to interpret inputs that do not precisely match this object’s format. With strict parsing, inputs must match this object’s format.
@qqilihq
Still getting null values, do i need to change anything in the code. How do i point out my “convertedDate” variable to new date column(date-mod)