Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi all,
I have a requirement to extract date and time as separate column from the same column.
my input column has data like "2018-09-27 18:48:24"
i want column1 to have data like "2018-09-27" and column2 to "18:48:24".
i tried TalendDate.formatDate("yyyy-MM-dd", input column name), but it didn't worked.
Hi @shong ,
I found that the source column had data only for HH:mm so i changed the from HH:mm:ss to HH:mm. it worked.
@keshav1991 , you need to convert date data type to sting and then split based on space.
TalendDate.formatDate("yyyy-MM-dd hh:mm:ss", input column name)
@keshav1991 , yes
I Have changed the input column to string and i used the "formatDate" function, but no luck.
@keshav1991 , what is the source data type for relationship_created_on ,if it is string, then you can split based on space.
Hi Keshav,
formatDate output will be of string type. So, you need to parse it to date type before loading it into a date column.
Below script will help you split date & Time stamp separately.
TalendDate.parseDate("yyyy-MM-dd",TalendDate.formatDate("yyyy-MM-dd",row2.HIRE_DATE_TIMESTAMP ))
TalendDate.parseDate("HH:mm:ss",TalendDate.formatDate("HH:mm:ss", row2.HIRE_DATE_TIMESTAMP))
PFB TMap configuration for reference.
Relationship_created_on column is of datetime datatype, and when i test it from tmap console i am getting below error.
attaching the error screenshot.
do i need worry about it or simply i can ignore and move forward