
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Converting date to string and Integer to String in TMAP
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,

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
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

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Convert String to Date :
TalendDate.parseDate("yyyy-MM-dd",Var.date_string )
Convert Int to Date :
TalendDate.parseDate("yyyyMMdd", Integer.toString(Var.date_int) )
Dates_Talend.png

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Can you also please confirm how to check the null in the same syntax? using formatDate.
