I tried to find the answer to this for some time today, and there is so much conflicting information ....
What I would like to do is get the current unix timestamp in android and then convert it to a format that allows me to getHours () and getMinutes ().
I am currently doing this:
int time = (int) (System.currentTimeMillis()); Timestamp ts = new Timestamp(time); mHour = ts.getHours(); mMinute = ts.getMinutes();
But this does not give me the correct value for the hour or minute (it returns 03:38 for the current time of the East Coast 13:33).
android date unix timestamp
Tom g
source share