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

powershell Start-Process exit code -1073741502 when used with Credential from a windows service environment -

twig - Using Twigbridge in a Laravel 5.1 Package -

c# - LINQ join Entities from HashSet's, Join vs Dictionary vs HashSet performance -