When using AlarmManager, you have two choices when setting the alarm: the first is the time in seconds since the device was rebooted (do not understand this option) or, if you want an โabsoluteโ time, then you need to provide UTC time in ms.
I think this should work - in the past I did something similar ...
public long getUtcTimeInMillis(String datetime) { SimpleDateFormat sdf = new SimpleDateFormat("MM/dd/yyyy HH:mm:ss"); Date date = sdf.parse(datetime);
Personally, I would recommend using a non-localized format, for example yyyy-MM-dd HH:mm:ss for any used date / time if you want to serve users around the world.
International standard ISO 8601 yyyy-MM-dd HH:mm:ss.SSSZ , but I usually did not go that far.
source share