Get system time using System class
- /*
- Get system using System class
- This example shows how to get the system time using currentTimeMillis
- method of Java System class.
- */
- public class GetSystemTime {
- public static void main(String[] args) {
- /*
- * To get system time use,
- * static long currentTimeMillis() method of
- * System class.
- *
- * This method returns the time in milliseconds since
- * midnight, January 1, 1970 UTC
- */
- long lnSystemTime = System.currentTimeMillis();
- System.out.println("Milliseconds since midnight, January 1, 1970 UTC : "
- + lnSystemTime);
- }
- }
- /*
- Output would be system dependent. Typical output would be
- Milliseconds since midnight, January 1, 1970 UTC : 1229529358581
- */



