Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Hexa Time method for a tutorial on the SSaurel's Blog
private String getHexaTime() {
Calendar c = Calendar.getInstance();
int h = c.get(Calendar.HOUR_OF_DAY) * 255 / 23;
int m = c.get(Calendar.MINUTE) * 255 / 59;
int s = c.get(Calendar.SECOND) * 255 / 59;
return "#" + String.format("%02X", h) + String.format("%02X", m) + String.format("%02X", s);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment