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

Popular posts from this blog

twig - Using Twigbridge in a Laravel 5.1 Package -

jdbc - Not able to establish database connection in eclipse -

firemonkey - How do I make a beep sound in Android using Delphi and the API? -