import java.util.Date;
import com.moment.Moment;
public class DateExample {
public static void main(String[] args) {
Moment now = Moment.now();
String formattedDateTime = now.format("yyyy-MM-dd HH:mm:ss");
System.out.println("Current Date and Time: " + formattedDateTime);
Moment newDateTime = now.add(1, Moment.TimeUnit.DAYS);
System.out.println("Date after adding 1 day: " + newDateTime.format("yyyy-MM-dd"));
Moment futureDateTime = Moment.parse("2022-01-01 00:00:00", "yyyy-MM-dd HH:mm:ss");
boolean isFuture = futureDateTime.isAfter(now);
System.out.println("Is the future date and time after the current date and time? " + isFuture);
}
}
<dependencies>
<dependency>
<groupId>com.moment</groupId>
<artifactId>moment</artifactId>
<version>1.0.0</version>
</dependency>
</dependencies>