Search code examples
javadatetimeoperating-systembios

Get BIOS Time in Java


Is there a way in Java to get the BIOS date and time?

Does Java use the BIOS (Basic Input/Output System) Datetime when you call java.util.Calendar.getInstance() or new java.util.Date()?

I do know that Java somehow works the current Date and time using January 1, 1970, 00:00:00 GMT as a base.

But how exactly?


Solution

  • It asks the operating system, which may or may not ask the BIOS.

    These dates are based on that epoch in this way:

    new Date(0); // == Thu Jan 01 01:00:00 GMT 1970