1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
/* 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 */ |
Add Comment