Skip to main content
Announcements
See what Drew Clarke has to say about the Qlik Talend Cloud launch! READ THE BLOG
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Converting date to string and Integer to String in TMAP

Hi,
Could you some one advise on Converting date to string and Integer to String in TMAP.
This conversion should happen only in Tmap but not with tconvertype ...
Thanks,
Labels (2)
5 Replies
Anonymous
Not applicable
Author

Hi,
You can use method  String.valueOf()in tMap to c onvert  Integer to String and TalendDate.formatDate("yyyy-MM-dd",myDate) to convert  date to string.
Please take a look at my screenshots.
Best regards
Sabrina
0683p000009MEOi.png
Anonymous
Not applicable
Author

Hi

Please me on this below code. I have to change a date column to string type and the validate that whether it is valid date or not?

For validation it should come 0 or 1 a s output.

 


Capture.PNG
Anonymous
Not applicable
Author

@shivapanchal 

 

You have specified that you want to convert a date column to String and then validate whether its date. First of all, if the input column is having date data type, it will be always succeed in validation. So I assume your query is to check whether an input string is date or not. If has to give 1 as output if its a date value and 0 if its not a date value.

 

Please refer the below solution for this scenario.

0683p000009M7Rf.png

 

0683p000009M67H.png

 

The function is as shown below.

TalendDate.isDate(row1.data,"yyyy-MM-dd") ?"1":"0"

Warm Regards,
Nikhil Thampi

Please appreciate our Talend community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved

Anonymous
Not applicable
Author

Convert String to Date : 

TalendDate.parseDate("yyyy-MM-dd",Var.date_string )

 

Convert Int to Date : 

TalendDate.parseDate("yyyyMMdd", Integer.toString(Var.date_int) )

0683p000009M7Vv.png


Dates_Talend.png
NewbieTalend
Contributor
Contributor

Can you also please confirm how to check the null in the same syntax? using formatDate.