Do you mean?

long millis = System.currentTimeMillis() % 1000;

BTW Windows doesn't allow timetravel to 1969

C:\> date
Enter the new date: (dd-mm-yy) 2/8/1969
The system cannot accept the date entered.
Answer from Peter Lawrey on Stack Overflow
🌐
Codecademy
codecademy.com › docs › java › calendar › .gettimeinmillis()
Java | Calendar | .getTimeInMillis() | Codecademy
August 31, 2023 - The .getTimeInMillis() method of the Calendar class returns the time represented by a Calendar object in the form of milliseconds. ... Looking for an introduction to the theory behind programming?
🌐
Current Millis
currentmillis.com › tutorials › system-currentTimeMillis.html
System.currentTimeMillis() | Unix Timestamp in Milliseconds
System.currentTimeMillis() - Unix Timestamps in Java & Javascript. Milliseconds & the Unix Epoch. UTC time
🌐
BeginnersBook
beginnersbook.com › 2014 › 01 › how-to-get-time-in-milliseconds-in-java
Java – Get time in milliseconds using Date, Calendar and ZonedDateTime
September 11, 2022 - import java.util.Calendar; import ... Date(); //This method returns the time in millis long timeMilli = date.getTime(); System.out.println("Time in milliseconds using Date class: " + timeMilli); //creating Calendar instance Calendar calendar = Calendar.getInstance(); //Returns ...
🌐
Baeldung
baeldung.com › home › java › java dates › convert time to milliseconds in java
Convert Time to Milliseconds in Java | Baeldung
May 2, 2019 - Simply put, Instant is a point in Java’s epoch timeline. We can get the current time in milliseconds from the Instant:
🌐
Tutorialspoint
tutorialspoint.com › java › lang › system_currenttimemillis.htm
Java System currentTimeMillis() Method
package com.tutorialspoint; public ... following result − ... The following example shows the usage of Java System currentTimeMillis() method....
🌐
JavaBeat
javabeat.net › home › how to get a current timestamp in java?
How to Get a Current Timestamp in Java?
May 6, 2024 - We can invoke the constructor of ... //Converting Current Timestamp in Milliseconds System.out.println("The Current Timestamp in Milliseconds == " + currentTS.getTime()); } }...
Find elsewhere
🌐
Coderanch
coderanch.com › t › 298478 › databases › milliseconds-java-sql-Timestamp
get milliseconds from java.sql.Timestamp (JDBC and Relational Databases forum at Coderanch)
The milliseconds are included in the database. I looked in the API and found the following note in the java.sql.Timestamp class: This type is a composite of a java.util.Date and a separate nanoseconds value. Only integral seconds are stored in the java.util.Date component. The fractional seconds - the nanos - are separate. The getTime method will return only integral seconds.
🌐
Java Code Geeks
javacodegeeks.com › home › core java
Java - Get Time In MilliSeconds - Java Code Geeks
December 17, 2020 - Current date : Sat Dec 12 21:48:25 ... 3925 Future date time in milliseconds : 61696501250000 · Next, use the Calendar class to get the time in milli seconds....
🌐
Mkyong
mkyong.com › home › java › how to get time in milliseconds in java
How to get time in milliseconds in Java - Mkyong.com
January 22, 2015 - package com.mkyong.test; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.Date; public class TimeMilisecond { public static void main(String[] argv) throws ParseException { SimpleDateFormat sdf = new SimpleDateFormat("dd-M-yyyy hh:mm:ss"); String dateInString = "22-01-2015 10:20:56"; Date date = sdf.parse(dateInString); System.out.println(dateInString); System.out.println("Date - Time in milliseconds : " + date.getTime()); Calendar calendar = Calendar.getInstance(); calendar.setTime(date); System.out.println("Calender - Time in mil
🌐
Javaprogramto
javaprogramto.com › 2020 › 12 › java-get-current-time-in-milliseconds.html
Java - Get Time In MilliSeconds JavaProgramTo.com
December 12, 2020 - A quick guide to get the current date time in milliseconds using Date, Calendar and java 8 api classes.
🌐
Oracle
docs.oracle.com › javase › 8 › docs › api › java › sql › Timestamp.html
Timestamp (Java Platform SE 8 )
4 days ago - Returns the number of milliseconds since January 1, 1970, 00:00:00 GMT represented by this Timestamp object.
🌐
javaspring
javaspring.net › blog › java-get-current-time-in-milliseconds
Java: Get Current Time in Milliseconds — javaspring.net
In this example, we record the start time and end time using System.currentTimeMillis(), and then calculate the difference to get the execution time of the loop. When logging events in an application, it is often useful to include a timestamp. We can use the current time in milliseconds for this purpose. import java.util.logging.Level; import java.util.logging.Logger; public class LoggingWithTimestamp { private static final Logger LOGGER = Logger.getLogger(LoggingWithTimestamp.class.getName()); public static void main(String[] args) { long currentTime = System.currentTimeMillis(); LOGGER.log(Level.INFO, "[" + currentTime + "] This is a log entry."); } }
🌐
CalliCoder
callicoder.com › how-to-get-current-epoch-timestamp-java
How to get current epoch timestamp in Java | CalliCoder
February 18, 2022 - public class CurrentEpochTimestampExample { public static void main(String[] args) { // Get epoch timestamp using System.currentTimeMillis() long currentTimestamp = System.currentTimeMillis(); System.out.println("Current epoch timestamp in millis: " + currentTimestamp); } } import java.time.Instant; public class CurrentEpochTimestampExample { public static void main(String[] args) { // Get current timestamp using Instant currentTimestamp = Instant.now().toEpochMilli(); System.out.println("Current epoch timestamp in millis: " + currentTimestamp); } }
🌐
GeeksforGeeks
geeksforgeeks.org › java › java-8-clock-millis-method-with-examples
Java 8 Clock millis() Method with Examples - GeeksforGeeks
June 17, 2021 - Below programs illustrates millis() method of java.time.Clock class: Program 1: Using millis() with Clock object created with systemDefaultZone ... // Java program to demonstrate millis() // method of Clock class import java.time.*; // create ...
🌐
TutorialsPoint
tutorialspoint.com › how-to-get-current-date-time-in-milli-seconds-in-java
How to get current date/time in milli seconds in Java?
The getTime() method of the Date class retrieves and returns the epoch time (number of milliseconds from Jan 1st 1970 00:00:00 GMT0. ... import java.util.Date; public class Sample { public static void main(String args[]){ //Instantiating the Date class Date date = new Date(); long msec = ...
🌐
Java67
java67.com › 2016 › 09 › how-to-get-current-timestamp-value-in-java.html
How to get current TimeStamp value in Java? Example | Java67
Btw, these are not the only way to get the current timestamp value, for example, if you just need long milliseconds from the 1st January 1970 then you can use the System.currentTimeMillis() which return millisecond from Epoch and System.nanoTime() ...