Android: how to get the number of milliseconds since January 1st 1970 for a defined date?

StackOverflow https://stackoverflow.com/questions/7652955

  •  06-02-2021
  •  | 
  •  

문제

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 !!

도움이 되었습니까?

해결책

Calendar c = new Calendar();

Calendar c = Calendar.getInstance();
// year, month, day, hourOfDay, minute
c.set(1990, 7, 12, 9, 34);
long millis = c.getTimeInMillis();
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top