1024programmer Java ThaiBuddhistDateatTime() method in Java, example

ThaiBuddhistDateatTime() method in Java, example

ThaiBuddhistDate atTime() method in Java, example

Original text: https://www . geeksforgeeks . org/thaibudhistate-attime-method-in-Java-with-example/

The atTime() method of Java . time . chrono . thaibudhistate class is used to get the thaibudhist date from another TemporalAccessor object according to the thaibudhist calendar system and time.

Syntax:

public ChronoLocalDateTime
atTime(LocalTime localTime)

Parameters: This method takes an object of type LocalTime as parameter.

Return Value: This method returns a ChronoLocalDateTime by adding this ThaiBuddhist date to the elapsed local time. A spatiotemporal datetime is a datetime that does not have a time zone within an arbitrary timetable. It is intended for advanced globalization use cases.

The following is an example illustrating the atTime() method:

Example 1:

// Java program to demonstrate
// atTime() method
import java.util.*;
import java.io.*;
import java.time.*;
import java.time.chrono.*;
public class GFG {
 public static void main(String[] argv)
 {
 try {
                                                                                            "n">ThaiBuddhistDate hidate
    = ThaiBuddhistDate.now();
   // Creating and initializing
 // TemporalAccessor object
 LocalTime localtime
 = LocalTime.= span>now();
   // Getting the Chrono Local date
 // time by using atTime() method
 ChronoLocalDateTime <ThaiBuddhistDate> date
                                       ="o">= hidate.atTime(localtime);
                                                     // Display the result
 System.out.println(
                                                      >"Chrono LocalDateTime is: "
 + date);
 }
 catch (DateTimeException e) {
 System.out.println(
    "Passed parameter can"
+ " not form a date");
System.out .println(
                                                       > + e);
 }
  }
}

Output:

Chrono LocalDateTime is :
ThaiBuddhist BE 2563-05-03T13:16:55.338

Example 2:

// Java program to demonstrate
// atTime() method
import java.util.*;
import java.io.*;
import java.time.*;
import java.time.chrono.*;
public class GFG {
public static void main(String[] argv)
 {
 try {
 // Creating and initializing
                                                                                                      >                                                                                                >ThaiBuddhistDate.now();
// Creating and initializing
                                                                                                    span> localtime
      = LocalTime.of(8, 20);
                                                         the Chrono Local date
 // time by using atTime() method
                                                                                 class="o"><ThaiBuddhistDate> date
                           = hidate. atTime(localtime);
                                   class="c1">// Display the result
 System.out.println(
                                   span class="s">"Chrono LocalDateTime is: "
 + date);
 }
 catch (DateTimeException e) {
 System.out.println(
    " Passed parameter can"
 + " not form a date" );
 System.out.println(
                                                 thrown: " + e);
}
}
}

Output:

Chrono LocalDateTime is:
ThaiBuddhist BE 2563- 05-03T08:20

Reference:https://docs.Oracle . com/javase/9/docs/API/Java/time/chrono/thaibudhistate . html # atTime-Java . time . local time-

/span> 25630503T08:20

Reference:https://docs . Oracle . com/javase/9/docs/API/Java/ time/chrono/thaibudhistate . html # atTime-Java . time . local time-

This article is from the internet and does not represent1024programmerPosition, please indicate the source when reprinting:https://www.1024programmer.com/thaibuddhistdateattime-method-in-java-example/

author: admin

Previous article
Next article

Leave a Reply

Your email address will not be published. Required fields are marked *

Contact Us

Contact us

181-3619-1160

Online consultation: QQ交谈

E-mail: [email protected]

Working hours: Monday to Friday, 9:00-17:30, holidays off

Follow wechat
Scan wechat and follow us

Scan wechat and follow us

Follow Weibo
Back to top
首页
微信
电话
搜索