<dependency>
<groupId>com.github.nscala-time</groupId>
<artifactId>nscala-time_2.11</artifactId>
<version>2.24.0</version>
</dependency>
import com.github.nscala_time.time.StaticDateTimeFormat;
import org.joda.time.DateTime;
import org.joda.time.format.DateTimeFormat;
DateTime now = DateTime.now();
DateTime specificDate = DateTime.parse("2022-01-01", DateTimeFormat.forPattern("yyyy-MM-dd"));
String formattedDate = now.toString(DateTimeFormat.forPattern("yyyy-MM-dd HH:mm:ss"));
DateTime threeDaysLater = now.plusDays(3);
import com.github.nscala_time.time.StaticDateTimeFormat;
import org.joda.time.DateTime;
import org.joda.time.format.DateTimeFormat;
public class DateTimeExample {
public static void main(String[] args) {
DateTime now = DateTime.now();
DateTime specificDate = DateTime.parse("2022-01-01", DateTimeFormat.forPattern("yyyy-MM-dd"));
System.out.println("Now: " + now);
System.out.println("Specific Date: " + specificDate);
String formattedDate = now.toString(DateTimeFormat.forPattern("yyyy-MM-dd HH:mm:ss"));
System.out.println("Formatted Date: " + formattedDate);
DateTime threeDaysLater = now.plusDays(3);
System.out.println("Three Days Later: " + threeDaysLater);
}
}