cat ./TimeTest.java
import java.util.Date;
import java.util.TimeZone;
public class TimeTest {
public static void main(String args[]) {
long time = System.currentTimeMillis();
String millis = Long.toString(time);
Date date = new Date(time);
System.out.println("Current time in milliseconds = " + millis + " => " + date.toString());
System.out.println("Current time zone: " + TimeZone.getDefault().getID());
}
}
$JAVA_HOME/bin/javac TimeTest.java
$JAVA_HOME/bin/java TimeTest
Current time in milliseconds = 1417528126582 => Tue Dec 02 16:48:46 MSK 2014
Current time zone: Europe/Moscow
Комментариев нет:
Отправить комментарий