Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
soujanyam
Contributor
Contributor

[resolved] cannot convert string to date in tMap

Hi everyone.
I've the csv file in which one column has date (which is defined as Number in csv file) but in tFileInpuDelimited it read as string in which some of the vales are like 20140424 and some are like 2014-04-25 in the same column.I've to parse this data into output component( tOracleOutput)as date column.So I tried to convert the string to date by using 
TalendDate.parseDate("yyyy-MM-dd",TalendDate.formatDate("yyyy-MM-dd",row1.column1)) and changed the output column as date with format yyyy-MM-dd.
Then I'm getting error as 
Unparseable date: "20140424".
How could I parse this into output component?
Any help would be greatly appreciated.
Thank you in advance.
Labels (3)
32 Replies
Anonymous
Not applicable

Hi Shri_Kul1,
Great it works. Feel free to let us know if there is any further help we can give.
Best regards
Sabrina
Anonymous
Not applicable

Hi Sabrina,
Please guide on following situation, 
i have columns TRISTARTDATE & TRIENDDATE with unix timestamp values with integer data type & i just want to convert them into a proper date format "MM/DD/YYYY" with date as data type.. i am trying following logic for the same but it giving wrong dates...

0683p000009MBt4.png
Proper dates are mentioned below. 

TRISTARTDATE (source)               TRISTARTDATE(Expected Target)                                      
1425148200                           03/01/2015
1423074600                           02/05/2015
Waiting for your reply
Regrds,
Shri_Kul1
Talend User
Anonymous
Not applicable

Hi Shri_Kul1,
Do you want to parse Integer/int to Date? If so, you can first read integer as a String :
(String.valueOf(1425148200))
then analyse the format of the string as a date
TalendDate.parseDate("yyyyMMdd",(String.valueOf(1425148200))).

Let us know if it is Ok with you.

Best regards
Sabrina
Anonymous
Not applicable

Hi Sabrina,
Ill try this & let you know in 2 hours.
Thanks,
Shri_Kul1
Talend user.
Anonymous
Not applicable

Hi Sabrina ,
I have applied logic which you described earlier, but seems to be not working properly.
please see the below image for your reference. It giving some error like -  Unparseable date: "1425148200"
0683p000009MBiq.png          
Error message.  
0683p000009MBoj.png
Anonymous
Not applicable

Hi,
Actually, your input is "Long" data type. I see you have *1000 in it. Converting long type to Date type on tMap
 should be new java.util.Date(long number)
Please see my screenshot.
Best regards
Sabrina
0683p000009MBUC.png
Anonymous
Not applicable

Hi Umesh,
Could you help me out for the issues am facing from yesterday.
Please guide on following situation, 
i have columns TRISTARTDATE & TRIENDDATE with unix timestamp values with integer data type & i just want to convert them into a proper date format "MM/DD/YYYY" with date as data type.. i am trying following logic for the same but it giving wrong dates...
Proper dates are mentioned below. 
TRISTARTDATE (source)               TRISTARTDATE(Expected Target)                                      
1425148200                           03/01/2015
1423074600                           02/05/2015


Waiting for your reply
Regrds,
Shri_Kul1
Talend User
Anonymous
Not applicable

Hi Sabrina / Umesh,
Thanks for your reply , but i am facing same issues , its not giving expected target dates
I have applied the logic you mentioned in your post .
0683p000009MBt9.png
Please see the below image for your reference , you will see the outcome that am getting by this logic.
I don't understand that why these values are converted into only   1970's dates????
 
0683p000009MBaT.png                  
tMap mapping.
0683p000009MBYw.png
Anonymous
Not applicable

Hi,
"dd" is day in month and "DDD" is day in year.
Please check your date pattern.
Best regards
Sabrina
0683p000009MBpw.png
Anonymous
Not applicable

Hey Sabrina,
If you see i have mentioned Date format "DD/MM/YYYY" in tMap @ target side for TRISTARTDATE column.

0683p000009MBsg.png    
That is my question why that milliseconds are getting converted like that???? 0683p000009MPcz.png

0683p000009MBtE.png
Thanks for your valuable responses... 0683p000009MACn.png 
Shri_kul1
Talend User