<dependency>
<groupId>io.github.cemartin</groupId>
<artifactId>timely</artifactId>
<version>1.3.0</version>
</dependency>
Timely timely = new Timely();
Timepoint now = timely.now();
String formattedDateTime = timely.format(now, "yyyy-MM-dd HH:mm:ss");
String dateTimeString = "2022-01-01 10:30:00";
Timepoint dateTime = timely.parse(dateTimeString, "yyyy-MM-dd HH:mm:ss");
import io.github.cemartin.timely.Timely;
import io.github.cemartin.timely.Timepoint;
public class DateTimeExample {
public static void main(String[] args) {
Timely timely = new Timely();
Timepoint now = timely.now();
String formattedDateTime = timely.format(now, "yyyy-MM-dd HH:mm:ss");
System.out.println("Formatted DateTime: " + formattedDateTime);
String dateTimeString = "2022-01-01 10:30:00";
Timepoint dateTime = timely.parse(dateTimeString, "yyyy-MM-dd HH:mm:ss");
System.out.println("Parsed DateTime: " + dateTime);
Timepoint tomorrow = timely.plusDays(now, 1);
System.out.println("Tomorrow: " + tomorrow);
long daysBetween = timely.daysBetween(now, tomorrow);
System.out.println("Days between now and tomorrow: " + daysBetween);
Timepoint oneYearLater = timely.plusYears(now, 1);
System.out.println("One year later: " + oneYearLater);
}
}