A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://www.w3resource.com/java-tutorial/util/date/java_date_gettime.php below:

Website Navigation


Java Date getTime() Method - w3resource

Java Date.getTime() MethodLast update on August 19 2022 21:51:24 (UTC/GMT +8 hours) public long getTime()

The getTime() method is used to get the number of milliseconds since January 1, 1970, 00:00:00 GMT represented by this Date object.

Package: java.util

Java Platform: Java SE 8

Syntax:

getTime()

Return Value:
the number of milliseconds since January 1, 1970, 00:00:00 GMT represented by this date.

Return Value Type:

Pictorial Presentation of Jave Date getTime() method:

Example: Java Date.getTime() Method

import java.util.Date;
import java.time.Instant;
public class Main {
   public static void main(String[] args) {

      // create a date
       Date date = new Date(2012, 2, 2);

      // Converts the said Date object to an Instant
       Instant i = date.toInstant();
       System.out.println(i);
   }
}
 

Output:

3912-03-02T00:00:00Z

Java Code Editor:

Previous:from Method
Next:hashCode Method




RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4