Home > Back-end >  Java beginners
Java beginners

Time:10-18

, o the problem is how to write, give a method

CodePudding user response:

For example
Long day=24 * 60 * 60 * 1000;//a day how many milliseconds
Long hour=60 * 60 * 1000;//an hour how many milliseconds
Long min=60 * 1000;//a minute how many milliseconds
Long the SEC=1000; A second//how many milliseconds
Long t=System. CurrentTimeMillis ();//the current milliseconds
System. Out. Printf (" 02 02 02 % d: % d: % d \ n ", (t % day/hour, hour (t %)/min, min) (t %/SEC).//the number of milliseconds to day modulo divided by the number of milliseconds an hour's time, for more than the number of milliseconds to take an hour is divided by the number of milliseconds one minute minute, for a minute more than the number of milliseconds to take a second divided by the number of milliseconds is seconds

CodePudding user response:

reference 1st floor qybao response:
for example
Long day=24 * 60 * 60 * 1000;//a day how many milliseconds
Long hour=60 * 60 * 1000;//an hour how many milliseconds
Long min=60 * 1000;//a minute how many milliseconds
Long the SEC=1000; A second//how many milliseconds
Long t=System. CurrentTimeMillis ();//the current milliseconds
System. Out. Printf (" 02 02 02 % d: % d: % d \ n ", (t % day/hour, hour (t %)/min, min) (t %/SEC).//the number of milliseconds to day modulo divided by the number of milliseconds an hour's time, for more than the number of milliseconds to take an hour is divided by the number of milliseconds one minute minute, for a minute more than the number of milliseconds to take a second divided by the number of milliseconds is second

Thanks, I understand
  • Related