This Java program uses the Instant class from the java.time package to get the current timestamp. The Instant.now() method is used to obtain the current timestamp in UTC timezone. The timestamp is then printed to the console using System.out.println().
import java.time.*; class Current_TimeStamp { public static void main(String[] args) { Instant ts = Instant.now(); System.out.println("Current Timestamp : " + ts); } }
Current Timestamp : 2022-11-05T08:04:34.089747900Z
Learn All in Tamil © Designed & Developed By Tutor Joes | Privacy Policy | Terms & Conditions