Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Is there any way to implement this SQL method to convert date to int in Talend Open Studio?
convert(int, convert(varchar(10), mydate, 112))
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); Date d = sdf.parse("2018-12-19"); sdf.applyPattern("yyyyMMdd"); String newDateString = sdf.format(d); //20181219
Use SimpleDateFormat parse/format depending on input/output data type (i.e. String or Date)
Can you give an example of input(s) and expected output(s)
Input : 2018-12-19
Expected output : 20181219
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); Date d = sdf.parse("2018-12-19"); sdf.applyPattern("yyyyMMdd"); String newDateString = sdf.format(d); //20181219
Use SimpleDateFormat parse/format depending on input/output data type (i.e. String or Date)
where should i write this code
can i convert the ouput to "int" type?
Depends on the requirements, if you're parsing row by row, pass the input to a tJavaRow and put that code in making sure to pass the row value in and then out.
You can use Integer.parseInt() to convert string to int.
Thank you soo much