Comparing Dates - 7.1

Talend Real-time Big Data Platform Studio User Guide

author
Talend Documentation Team
EnrichVersion
7.1
EnrichProdName
Talend Real-Time Big Data Platform
task
Design and Development
EnrichPlatform
Talend Studio
It is easy to use the compareDate routine, along with a tJava component to compare two dates, for example to check if the current date is identical to, earlier than or later than a specific date, according to the format specified.
System.out.println(TalendDate.compareDate(new Date(), TalendDate.parseDate("yyyy-MM-dd", "2025/11/24")));

In this example the current date is initialized by the Java function new Date() and the value -1 is displayed in the Run view to indicate that the current date is earlier than the second date.