Question

I have seen this post which explains how to get the number of milliseconds since 1970 for the CURRENT DATE:

how to get the number of seconds passed since 1970 for a date value?

My question is: how to get this value in milliseconds for any date ?

Thanks !!

Was it helpful?

Solution

Calendar c = new Calendar();

Calendar c = Calendar.getInstance();
// year, month, day, hourOfDay, minute
c.set(1990, 7, 12, 9, 34);
long millis = c.getTimeInMillis();
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top