java - So I'm tring to get a date as a string at the command line and convert it into milliseconds but it keeps adding five hours. Any ideas why? -
this code works when converts input milliseconds adds 5 hours. there fix this?
arraylist<string> timelist = new arraylist<string>(); scanner in = new scanner(system.in); system.out.println("please enter time arrived (hh:mm:ss): "); timelist.add(in.next()); simpledateformat format = new simpledateformat("hh:mm:ss"); string arrivetime = timelist.get(0); try{ date date1 = format.parse(arrivetime); long finaltime = date1.gettime(); }catch (exception e) { system.out.println("an error occurred"); }
i'm going guess you're in eastern time zone , confusing edt gmt.
Comments
Post a Comment