SimpleDateFormat always returns 1970.01.17 with wrong timezone
I have been using Processing 3.0, and I am trying to print a simple timestamp when my Arduino outputs certain values, but it is not working. I tried to use SimpleDateFormat, but it always returns 1970.01.17 17:48:35 GMT , rather than the actual time. Below is the MVCE: void setup () { SimpleDateFormat format = new SimpleDateFormat ("yyyy.MM.dd HH:mm:ss z"); format.setTimeZone (TimeZone.getDefault()); long timestamp = getTimeNow(); println(format.format(new Date(timestamp))); println(timestamp); } long getTimeNow () { Date d = new Date (); Calendar cal = new GregorianCalendar(); long current =