ThaiBuddhistDate now(Clock) method in Java with Example Last Updated : 20 May, 2020 Comments Improve Suggest changes Like Article Like Report The now() method of java.time.chrono.ThaiBuddhistDate class is used to get the current ThaiBuddhist date according to the ThaiBuddhist calendar system from the specified clock. Syntax: public static ThaiBuddhistDate now(Clock clock) Parameter: This method takes the object of the clock on the basis of which ThaiBuddhist date is going to be formed. Return Value: This method returns the current ThaiBuddhist date according to the ThaiBuddhist calendar system from the specified clock. Below are the examples to illustrate the now() method: Example 1: Java // Java program to demonstrate now() method import java.util.*; import java.io.*; import java.time.*; import java.time.chrono.*; import java.time.temporal.*; public class GFG { public static void main(String[] argv) { try { // Creating and initializing clock Clock clock = Clock.systemUTC(); // Creating and initializing // ThaiBuddhistDate Object ThaiBuddhistDate hidate = ThaiBuddhistDate.now(clock); // Display the result System.out.println( "ThaiBuddhistDate: " + hidate); } catch (DateTimeException e) { System.out.println( "Passed parameter can" + " not form a date"); System.out.println( "Exception thrown: " + e); } } } Output: ThaiBuddhistDate: ThaiBuddhist BE 2563-05-03 Example 2: Java // Java program to demonstrate now() method import java.util.*; import java.io.*; import java.time.*; import java.time.chrono.*; import java.time.temporal.*; public class GFG { public static void main(String[] argv) { try { // Creating and initializing clock Clock clock = Clock.systemDefaultZone(); // Creating and initializing // ThaiBuddhistDate Object ThaiBuddhistDate hidate = ThaiBuddhistDate.now(clock); // Display the result System.out.println( "ThaiBuddhistDate: " + hidate); } catch (DateTimeException e) { System.out.println( "Passed parameter can" + " not form a date"); System.out.println( "Exception thrown: " + e); } } } Output: ThaiBuddhistDate: ThaiBuddhist BE 2563-05-03 Reference: https://docs.oracle.com/javase/9/docs/api/java/time/chrono/ThaiBuddhistDate.html#now-java.time.Clock- Comment More infoAdvertise with us Next Article ThaiBuddhistDate atTime() method in Java with Example R rohitprasad3 Follow Improve Article Tags : Java Java-Functions Java-Time-Chrono package Practice Tags : Java Similar Reads ThaiBuddhistDate now(ZoneId) method in Java with Examples The now() method of java.time.chrono.ThaiBuddhistDate class is used to get the current ThaiBuddhist date according to the ThaiBuddhist calendar system in the specified zone. Syntax: public static ThaiBuddhistDate now(ZoneId zone) Parameter: This method takes the object of zone id on the basis of whi 2 min read ThaiBuddhistDate atTime() method in Java with Example The atTime() method of java.time.chrono.ThaiBuddhistDate class is used to get the ThaiBuddhist date and time according to ThaiBuddhist calendar system from another TemporalAccessor object. Syntax: public ChronoLocalDateTime atTime(LocalTime localTime) Parameter: This method takes the object of type 2 min read ThaiBuddhistDate atTime() method in Java with Example The atTime() method of java.time.chrono.ThaiBuddhistDate class is used to get the ThaiBuddhist date and time according to ThaiBuddhist calendar system from another TemporalAccessor object. Syntax: public ChronoLocalDateTime atTime(LocalTime localTime) Parameter: This method takes the object of type 2 min read ThaiBuddhistDate from() method in Java with Example The from() method of java.time.chrono.ThaiBuddhistDate class is used to get the ThaiBuddhist date according to the ThaiBuddhist calendar system for the particular temporal object. Syntax: public static ThaiBuddhistDate from(TemporalAccessor temporal) Parameter: This method takes the object of any te 2 min read ThaiBuddhistDate getEra() method in Java with Example The getEra() method of java.time.chrono.ThaiBuddhistDate class is used to retrieve the era related to this ThaiBuddhist date. Syntax: public ThaiBuddhistEra getEra() Parameter: This method does not accept any parameter. Return Value: This method returns the era of this ThaiBuddhist date. Below are t 2 min read ThaiBuddhistDate getLong() method in Java with Example The getLong() method of java.time.chrono.ThaiBuddhistDate class is used to retrieve the passed temporal field in long format. Syntax: public long getLong(TemporalField field) Parameter: This method takes any type of temporal field as a parameter. Return Value: This method returns the passed temporal 2 min read Like