Calendar calendar = Calendar.getInstance();
calendar.setTimeInMillis(0);
This sets it to the deafult value. How do I set it to zero?
Calendar calendar = Calendar.getInstance();
calendar.setTimeInMillis(0);
This sets it to the deafult value. How do I set it to zero?
You should probably be aware of what setTimeInMillis()
expects:
public void setTimeInMillis(long millis)
Sets this Calendar's current time from the given long value.
Parameters:
millis
- the new time in UTC milliseconds from the epoch.
The epoch is defined as:
An instant in time can be represented by a millisecond value that is an offset from the Epoch, January 1, 1970 00:00:00.000 GMT (Gregorian).
You can zero-out what value you want using the set method. For example:
calendar.set(Calendar.HOUR, 0);
calendar.set(Calendar.MINUTE, 0);
calendar.set(Calendar.SECOND, 0);
calendar.set(Calendar.MILLISECOND, 0);