Date.setTime(long time) has the following syntax.
public void setTime(long time)
In the following code shows how to use Date.setTime(long time) method.
/*from ww w . j ava2 s.c o m*/ import java.util.*; public class Main { public static void main(String[] args) { Date date = new Date(); date.setTime(10000); // print the result System.out.println("Time after setting: " + date.toString()); } }
The code above generates the following result.