getTime(): This method is available in java.util.Date class of Java.
Syntax:
long java.util.Date.getTime()
This method returns the number of milliseconds since January 1, 1970, 00:00:00 GMT represented by this Date object.
Parameters: NA
Returns: the number of milliseconds since January 1, 1970, 00:00:00 GMT represented by this date.
Exceptions: NA
Approach
Java
import java.util.Date;public class DategetTime {public static void main(String[] args) {Date date = new Date();System.out.println(date.getTime());}}
Output:
1643546204564
No comments:
Post a Comment