Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

extracting date and time as separate columns from same column

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.

 

Labels (3)
14 Replies
Anonymous
Not applicable
Author

Hi @knknaveen ,

i have made changes as per you screenshot and script,but syill i'm getting below error.

[statistics] connecting to socket on port 4045
[statistics] connected
Exception in component tMap_1 (STG_TO_WAREHOUSE_REPO)
java.lang.RuntimeException: java.text.ParseException: Unparseable date: "2019-06-01"
at routines.TalendDate.parseDate(TalendDate.java:942)
at routines.TalendDate.parseDate(TalendDate.java:886)
at local_project.stg_to_warehouse_repo_0_1.STG_TO_WAREHOUSE_REPO.tDBInput_2_inProcess(STG_TO_WAREHOUSE_REPO.java:2468)
at local_project.stg_to_warehouse_repo_0_1.STG_TO_WAREHOUSE_REPO.runJobInTOS(STG_TO_WAREHOUSE_REPO.java:5829)
at local_project.stg_to_warehouse_repo_0_1.STG_TO_WAREHOUSE_REPO.main(STG_TO_WAREHOUSE_REPO.java:5678)
Caused by: java.text.ParseException: Unparseable date: "2019-06-01"
at java.text.DateFormat.parse(DateFormat.java:366)
at routines.TalendDate.parseDate(TalendDate.java:928)
... 4 more
[statistics] disconnected


screenshot_8.JPG
Anonymous
Not applicable
Author

For the error 'java.lang.RuntimeException: java.text.ParseException: Unparseable date: "2019-06-01"'
You should use the pattern as "yyyy-MM-dd" in the function TalendDate.parseDate("yyyy-MM-dd",xxxx)

BTW, please insert the images into your post body instead of attaching it.
Anonymous
Not applicable
Author

Thank you @shong , date issue looks resolved, but time is still giving error as it has issues. 

0683p000009M8Lt.jpg

Anonymous
Not applicable
Author

What is target app? I see the data type of these two columns are defined as Date, the time string are converted back to a Date.
Anonymous
Not applicable
Author

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.