Timely bugs

Those two cost me time and … more time.

I am testing timestamps. First I was wondering why my computer was generating a date in August instead of February!

result.append(calendar.get(Calendar.MONTH + 1));

Spot the error. …. MONTH)+1); would have been correct 🙁 My second mistake was in the same category of stupidity. The timestamp may not be older than one hour.

long nowstamp = System.currentTimeMillis();
if ((nowstamp - timestamp > 3600) || .....

I was alwas surprised that my timestamps seemed to be valid for only a few seconds. Maybe I should have multplied with 1000 to make them valid for one hour?

But now I learned how to use DateFormat classes 🙂

By Yashima

Writer of code and stories