How to convert christian year to thai year in Java?
you can use ThaiBuddhistDate
class in package - java.time.chrono
you can use below example for reference -
public class Test {
public static void main(String[] args) {
String date = "2020-12-31 20:08:00";
// Convert Thai Buddhist date to ISO date
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-mm-dd HH:MM:ss");
try {
ThaiBuddhistDate thaiBuddhistNow = ThaiBuddhistDate.from(LocalDate.parse(date,formatter));
System.out.println("Thai Buddhist Current Date from ISO: "
+ thaiBuddhistNow);
}catch (Exception e){
e.printStackTrace();
}
}
}