J
John Goche
Hello,
I want some code which will give me the number of milliseconds since
the Java epoch which is January 1, 1970. I try the following code, but,
alas, every time I run it I get a different value
instead of a constant. Any ideas of what
might be going wrong would be
sincerely appreciated.
import java.util.Calendar;
class T {
public static void main(String[] args) {
Calendar calendar = Calendar.getInstance();
calendar.set(Calendar.DAY_OF_MONTH, 28);
calendar.set(Calendar.MONTH, 2);
calendar.set(Calendar.YEAR, 2006);
long millis = calendar.getTime().getTime();
System.err.println(millis);
}
}
I want some code which will give me the number of milliseconds since
the Java epoch which is January 1, 1970. I try the following code, but,
alas, every time I run it I get a different value
instead of a constant. Any ideas of what
might be going wrong would be
sincerely appreciated.
import java.util.Calendar;
class T {
public static void main(String[] args) {
Calendar calendar = Calendar.getInstance();
calendar.set(Calendar.DAY_OF_MONTH, 28);
calendar.set(Calendar.MONTH, 2);
calendar.set(Calendar.YEAR, 2006);
long millis = calendar.getTime().getTime();
System.err.println(millis);
}
}