java时间转换,把秒转换为小时,分钟

import java.util.Scanner;




public class Timechange {
public static void main(String[] args)
{
Scanner input = new Scanner(System.in);
int hour,minute,second;
second = input.nextInt();
hour = second/3600;
minute = (second - hour*3600)/60;
second = second-hour*300-minute*60;
System.out.println(" hour is "+hour+" minute is "+minute+" second is "+second);

}
}

你可能感兴趣的:(java)