赞
踩
下面是运行示例:
Current date and time is May 16, 2012 10:34:23
Here is a sample run:
Current date and time is May 16, 2012 10:34:23
下面是参考答案代码:
public class CurrentDateAndTimeQuestion33 { public static void main(String[] args) { // Obtain the total milliseconds since midnight, Jan 1, 1970 long totalMilliseconds = System.currentTimeMillis(); // Obtain the total seconds since midnight, Jan 1, 1970 int totalDays = (int) (totalMilliseconds / 1000 / 60 / 60 / 24); long totalSeconds = totalMilliseconds / 1000; // Compute the current second in the minute in the hour long currentSecond = totalSeconds % 60; // Obtain the total minutes long totalMinutes = totalSeconds / 60; // Compute the current minute in the hour long currentMinute
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。