Java Time API – Using LocalDateTime


LocalDateTime combines date and time but does not handle time zones.

Source Code

import java.time.LocalDateTime;

public class DateTimeExample {
    public static void main(String[] args) {
        LocalDateTime now = LocalDateTime.now();
        System.out.println("Current DateTime: " + now);
    }
}
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments