How to perform validation on date field

Four Stars

How to perform validation on date field

Hello there! 

I have a Date field/Column in input and I want to apply validation operation like (Is_valid) to check whether the input date is in particular format (lets say dd-mm-yyyy) or not, if not I want to reject that record.

Please let me know/suggest me how can I perform this is_valid on date field

 

Thanks in advance

Highlighted
Fifteen Stars TRF
Fifteen Stars

Re: How to perform validation on date field

Have a look to TalendDate.parseDate() method


TRF
Four Stars

Re: How to perform validation on date field

Actually am a beginner in talend and I tried the various date function's like TalendDate.formatDate, TalendDate.parseDate, TalendDate.isDate. 

but didn't get solution.

 

Could you please help me with an example or solution for below case.

My input filed 't_date' is in format 'dd-MM-yyyy', here I want to reject the records if it is not in the specified format else it should be proceed further.

 

By the way thanks for your reply!

Fifteen Stars TRF
Fifteen Stars

Re: How to perform validation on date field

Did you try:
TalendDate.isDate(row1.t_date, "dd-MM-yyyy")
This suppose t_date is a String.

TRF

2019 GARNER MAGIC QUADRANT FOR DATA INTEGRATION TOOL

Talend named a Leader.

Get your copy

OPEN STUDIO FOR DATA INTEGRATION

Kickstart your first data integration and ETL projects.

Download now

What’s New for Talend Summer ’19

Watch the recorded webinar!

Watch Now

Best Practices for Using Context Variables with Talend – Part 2

Part 2 of a series on Context Variables

Blog

Best Practices for Using Context Variables with Talend – Part 1

Learn how to do cool things with Context Variables

Blog

Migrate Data from one Database to another with one Job using the Dynamic Schema

Find out how to migrate from one database to another using the Dynamic schema

Blog