1
0
mirror of https://github.com/moparisthebest/Yaaic synced 2025-02-16 15:00:14 -05:00

Fixed timestamp. Prefix number with 0 if they are < 10

This commit is contained in:
Sebastian Kaspari 2010-03-14 01:07:11 +01:00
parent 2d585d6a72
commit 5140646fd4

View File

@ -161,11 +161,12 @@ public class Message {
Date date = new Date(); Date date = new Date();
int hours = date.getHours(); int hours = date.getHours();
int minutes = date.getMinutes();
if (!use24hFormat) { if (!use24hFormat) {
hours = Math.abs(24 - hours); hours = Math.abs(24 - hours);
} }
return "[" + hours + ":" + date.getMinutes() + "] "; return "[" + (hours < 10 ? "0" + hours : hours) + ":" + (minutes < 10 ? "0" + minutes : minutes) + "] ";
} }
} }