Tools for calculating tribal conflict duration

Source: Internet
Author: User
Tags time and seconds

Today is nothing to do, want to find a calculation of tribal conflict building upgrade time. Found no handy, wrote a console output of a small program.

ImportJava.text.SimpleDateFormat;Importjava.util.Date;ImportJava.util.Scanner; Public classT5 { Public Static voidMain (string[] args) {
Gets the current system millisecond Date nowdate=NewDate (System.currenttimemillis ());
Enter building duration System.out.println ("Please enter the time and minute, format is Hh:mm:ss"); Scanner input=NewScanner (system.in); String s=Input.next (); intIndex1=s.indexof (":"); intIndex2=s.indexof (":", index1+1); intHh=integer.parseint (s.substring (0, index1)); intMi=integer.parseint (S.substring (index1+1, Index2)); intSs=integer.parseint (S.substring (index2+1)); intzong=hh*3600+mi*60+SS; Longzhihou= nowdate.gettime () +zong*1000; SimpleDateFormat format=NewSimpleDateFormat ("Yyyy-mm-dd HH:mm:ss");
Get Date System.out.println (HH+ "Hours" +mi+ "min" +ss+ "seconds after" +format.format "(NewDate (Zhihou)); }}

Printing results:

Please enter the time and seconds, in the format hh:mm:ss12:30:0012 hours 30 minutes 0 seconds after: 2016-01-19 06:14:1

Later I will try to write an interface ...

Tools for calculating tribal conflict duration

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.