-8

When I print this in my main method

System.out.println(System.currentTimeMillis());

I get a really massive number.

I dont know what it means? Can you please explain?

1 Answers1

-1

The value returned by System.currentTimeMillis() represents the number of milliseconds since January 1st 1970, 0:00 UTC.

Returns the current time in milliseconds. Note that while the unit of time of the return value is a millisecond, the granularity of the value depends on the underlying operating system and may be larger. For example, many operating systems measure time in units of tens of milliseconds. See the description of the class Date for a discussion of slight discrepancies that may arise between "computer time" and coordinated universal time (UTC).

Returns: the difference, measured in milliseconds, between the current time and midnight, January 1, 1970 UTC.

Source: System javadocs

Jeroen Steenbeeke
  • 3,466
  • 5
  • 17
  • 23
  • 1
    the *milli*seconds – Viktor Mellgren Jun 03 '22 at 11:37
  • 1
    @ViktorMellgren corrected. Thanks. Shouldn't be so hasty in my responses – Jeroen Steenbeeke Jun 03 '22 at 11:38
  • I don’t think indulging a Question directly answered by one sentence in the Javadoc is a helpful contribution to Stack Overflow. – Basil Bourque Jun 03 '22 at 17:35
  • @BasilBourque to be fair I posted a comment with similar information prior to my answer. What often happens is that after I post such a comment someone else repeats my comment as an answer and gets awarded points for it, no matter how trivial the question or answer. I suppose I figured I might as well be the one getting points in such a case. – Jeroen Steenbeeke Jun 04 '22 at 20:56
  • @JeroenSteenbeeke I understand. This real problem is Stack Overflow nowadays getting flooded with questions of lower and lower quality, homework dumps, etc. – Basil Bourque Jun 04 '22 at 21:23