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

Announcements
Qlik GA: Multivariate Time Series in Qlik Predict: Get Details
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

[resolved] Convert data type string to time

Hi all,
I'm having real problem to upload one table of the db, online. I have a 'time' field in my table (initialy 'Time' database type and 'Date' type in tMap), which i read in tMap as a string and i want to convert it to time in the output. I have used these to methods
//TalendDate.formatDate("HH:mm:ss",row1.ora);
//TalendDate.parseDate("yyyy-MM-dd HH:mm:ss",row1.ora);
..but none of them worked. What should i do? If you need more information just tell me, please! It's the first time i write here so i may be uncomplete..
P.S: The reason i run through this solution is because i couldn't export the 'ora' column as it's initial type. It always showed me the error pictured in pic a5.
Thanks in advance!
0683p000009MDfL.png
Labels (2)
1 Solution

Accepted Solutions
Anonymous
Not applicable
Author

Hi
Try this expression
TalendDate.parseDate("HH:mm:ss",row1.ora)

View solution in original post

11 Replies
Anonymous
Not applicable
Author

Hi Mirela,
What is your source time? Is the date format yyyy-MM-dd HH:mm:ss?Such as, 2013-02-19 16:32:20?
Try this expression:
TalendDate.parseDate("yyyyMMddHHmmss",row1.ora)

Your feedback will be preferred.
Best regards
Sabrina
Anonymous
Not applicable
Author

Hi all,
I'm having real problem to upload one table of the db, online. I have a 'time' field in my table (initialy 'Time' database type and 'Date' type in tMap), which i read in tMap as a string and i want to convert it to time in the output. I have used these to methods
//TalendDate.formatDate("HH:mm:ss",row1.ora);
//TalendDate.parseDate("yyyy-MM-dd HH:mm:ss",row1.ora);
..but none of them worked. What should i do? If you need more information just tell me, please! It's the first time i write here so i may be uncomplete..
P.S: The reason i run through this solution is because i couldn't export the 'ora' column as it's initial type. It always showed me the error pictured in pic a5.
Thanks in advance!

Hi Mirela,
Can you please share the image with the column details of row1.ora visible in tMap.
Also, i tried a case on my machine where i had a string input to tMap and have parsed it to date in output using TalendDate.parseDate("yyyy-MM-dd HH:mm:ss",row1.ora) where the input string date was in the format "yyyy-MM-dd HH:mm:ss" for e.g. "2013-02-18 10:20:30" and the output in tMap was of Date datatype which can be in any format say "dd-MM-yyyy hh:MM:ss". It works fine for me.
Please find attached the image depicting the same.
0683p000009MDc0.jpg
Anonymous
Not applicable
Author

Hi Mirela,
Do you job work well? Or there is still a problem?
Best regards
Sabrina
Anonymous
Not applicable
Author

hi
thanks for replying!
I tried this expression TalendDate.parseDate("yyyy-MM-dd HH:mm:ss",row1.ora) as you guys said but still no result 0683p000009MPcz.png
The ora column type in db is 'time'
Diwakar please find attached the pics you requested. I hope we'll get to a solution about this..
Best regards to both
Anonymous
Not applicable
Author

Diwakar please find attached the pics you requested.

Image missing..
Anonymous
Not applicable
Author

sorry i'm trying to upload them but apparently they won't show up .. 0683p000009MPcz.png
0683p000009MDMe.png 0683p000009MDrT.png
Anonymous
Not applicable
Author

sorry i'm trying to upload them but apparently they won't show up .. 0683p000009MPcz.png

Limits: 20 images per post, each image must be less then 1024x768 pixels and 200 KB
Make sure you comply to the above before attaching.
Anonymous
Not applicable
Author

Hi,
Can you also post the values of the source input string. I believe it is not in the correct format.
Anonymous
Not applicable
Author

Ora Input example: 06:15:00
The db type of the input is originally "time" , than it's converted to string by tConvertType.. goes into tMap as string.. out of tMap as string. I need now to reconvert it at least at "data" type otherwise i will need to convert it via a php function in the program that uses this database. But it would low down the performance of the program and that's why i need to reconvert it back from Talend.
Not sure if i was clear enough 😕