今日のエポック時間を取得するには:-
SimpleDateFormat df = new SimpleDateFormat("dd/MM/yyyy");
String _date = df.format(Calendar.getInstance().getTime());
Long notificationID = strDateToUnixTimestamp(_date); //Gives Today Epoch Time.
private static long strDateToUnixTimestamp(String dt) {
DateFormat formatter;
Date date = null;
long unixtime;
formatter = new SimpleDateFormat("dd/MM/yy");
try {
date = formatter.parse(dt);
} catch (ParseException ex) {
ex.printStackTrace();
}
unixtime = date.getTime() / 1000L;
return unixtime;
}
ミリ秒単位の現在の時刻とミリ秒単位の今日の時刻の違いを確認するには [Date 00:00:00]。
Log.i("Notification ID", String.valueOf(notificationID) + ": "+ System.currentTimeMillis()/1000);
SOを投稿すると、数時間グーグルで検索したところ、探していたものが見つかりました。他の人に役立つことを願っています。