
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Parse to MM/dd/yyyy format Date from dd-Mon-yy Format and Validation
Hi All,
I have a scenario. My Source Data Date is coming in dd-Mon-yy. Example 9-Jun-17. I want to convert it into MM/dd/yyyy. Final Desired Output will be 6/9/2017. Using TalendDate.parseDate("MM/dd/yyyy",row1.START_DATE). But getting Unparseable Date error. Also want to create a Variable Port where it will check for format..In the Variable Port Condition is like this
TalendDate.isDate(row1.START_DATE,"dd-MMM-yy",true). But it is also not working. Can anyone please help
- « Previous Replies
-
- 1
- 2
- Next Replies »
Accepted Solutions

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You need to do it like this.....
routines.TalendDate.formatDate("d/M/yyyy", routines.TalendDate.parseDate("dd-MMM-yy", row.datacolumn))
....for 6/9/2017, or like this.....
routines.TalendDate.formatDate("dd/MM/yyyy", routines.TalendDate.parseDate("dd-MMM-yy", row.datacolumn))
....for 06/09/2017.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
START_DATE column is String in Source

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Can anyone with any help? @xdshi,

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi @manodwhb

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You need to do it like this.....
routines.TalendDate.formatDate("d/M/yyyy", routines.TalendDate.parseDate("dd-MMM-yy", row.datacolumn))
....for 6/9/2017, or like this.....
routines.TalendDate.formatDate("dd/MM/yyyy", routines.TalendDate.parseDate("dd-MMM-yy", row.datacolumn))
....for 06/09/2017.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
@abhi90,check this also may be usefull.tmap
job

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
@abhi90,to check the date is valid or not in variable port you should use TalendDate.isDate(row2.Date,"d-MMM-yy",true) as per your input date format.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
It should be made clear that a Date is a number. It does not come with a format, but it can be formatted for when it is output as a String. The example I gave takes a date delivered in a String format, converts it to a Date (just a number) and then converts it back to a String. When Talend outputs a Date in a tLogRow it implicitly converts it to a String (the same with numbers). However, a component receiving a Date from a tLogRow will just receive a number.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
hi you can also use this expression
TalendDate.parseDateLocale("dd-MMM-yy",row2.date,"EN")

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

- « Previous Replies
-
- 1
- 2
- Next Replies »