Using the Thai Buddhist and ISO Calendars - Java Date Time

Java examples for Date Time:Custom Date Calendar

Description

Using the Thai Buddhist and ISO Calendars

Demo Code

import java.time.LocalDate;
import java.time.chrono.ThaiBuddhistDate;

public class Main {
  public static void main(String[] args) {
    ThaiBuddhistDate thaiBuddhistNow = ThaiBuddhistDate.now();
    LocalDate isoNow = LocalDate.now();
    System.out.println("Thai Buddhist Current Date: " + thaiBuddhistNow);
    System.out.println("ISO Current Date: " + isoNow);

    // Convert Thai Buddhist date to ISo date and vice-versa
    ThaiBuddhistDate thaiBuddhistNow2 = ThaiBuddhistDate.from(isoNow);
    LocalDate isoNow2 = LocalDate.from(thaiBuddhistNow);
    System.out.println("Thai Buddhist Current Date from ISO: " + thaiBuddhistNow2);
    System.out.println("ISO Current Date from Thai Buddhist: " + isoNow2);
  }// ww w.  ja v  a  2 s  .  c o m
}

Result


Related Tutorials