Where is the Java LocalDateTime.now () timezone?

Java's LocalDateTime.now () says it gets the default timezone, but I tried to figure it out.

Source code

package test;

import java.time.LocalDateTime;
import java.time.ZoneId;

public class Test {
    public static void main(String[] args) {
        System.out.println("LocalDateTime.now() " + LocalDateTime.now().toString());
        System.out.println("LocalDateTime.now(ZoneId.of(\"Asia/Tokyo\") " + LocalDateTime.now(ZoneId.of("Asia/Tokyo")).toString());
        System.out.println("LocalDateTime.now(ZoneId.of(\"GMT\") " + LocalDateTime.now(ZoneId.of("GMT")).toString());
    }
}

Execution result (implemented at 14:33 on March 13, Japan time)

LocalDateTime.now() 2018-03-13T14:33:01.625
LocalDateTime.now(ZoneId.of("Asia/Tokyo") 2018-03-13T14:33:01.625
LocalDateTime.now(ZoneId.of("GMT") 2018-03-13T05:33:01.625

Recommended Posts

Where is the Java LocalDateTime.now () timezone?
Java is the 5th day
[Java] Note the case where equals is false but == is ture.
What is the best file reading (Java)
What is the main method in Java?
Where the follow function implementation is stuck
The Java EE Security API is here!
What is java
Where about java
What is Java <>?
What is Java
What is the Java Servlet / JSP MVC model?
The order of Java method modifiers is fixed
The intersection type introduced in Java 10 is amazing (?)
What is the volatile modifier for Java variables?
[Java] Something is displayed as "-0.0" in the output
[Java] The word passing by reference is bad!
[Java] Where is the implementation class of annotation that exists in Bean Validation?
The comparison of enums is ==, and equals is good [Java]
Which is better, Kotlin or Java in the future?
What is Java Encapsulation?
[JAVA] What is the difference between interface and abstract? ?? ??
timedatectl and Java TimeZone
What is Java technology?
What is Java API-java
[Java] What is flatMap?
What is the difference between Java EE and Jakarta EE?
[Java] What is JavaBeans?
[Java] What is ArrayList?
The story that .java is also built in Unity 2018
What is the LocalDateTime class? [Java beginner] -Date and time class-
Find out all timezone IDs supported by the Java TimeZone class
[Java] [Play Framework] Until the project is started with Gradle
[Java] com.sun.glass.WindowEvent is imported and the window does not close
Java: The problem of which is faster, stream or loop
What is Java Assertion? Summary.
The migration file is duplicated
What is the pluck method?
about the where method (rails)
This is the first post.
The Java Primer passed the blockage
What is the BufferedReader class?
What is a Java collection?
[Windows] Java code is garbled
[Java] What is jaee j2ee?
[Java] What is class inheritance?
[Java] I implemented the combination.
Is the ternary operator evil?
What is the constructor for?
Until the code is executed
[Java basics] What is Class?
What is java escape analysis?
I studied the constructor (java)
What is the initialize method?
Input to the Java console
This is the Excel output in Java! "JXLS" official document translation
The procedure for applying for the Java Bronze certification exam is too complicated.
[Java Servlet] Senri no Michi is one step to the second
The milliseconds to set in /lib/calendars.properties of Java jre is UTC
Examine the list of timezone IDs available in the Java ZoneId class
[Java] What is the difference between form, entity and dto? [Bean]