回覆列表
  • 1 # 工控大螺絲

    public class ChangeTime {

    public static void main(String[] args) {

    //時間總的秒數

    int seconds = 30654;

    //開始時間

    int startHours = seconds/3600;

    int startMinutes = (seconds%3600)/60;

    int startSeconds = (seconds%3600)%60;

    Calendar cal=Calendar.getInstance();//使用日曆類

    SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");//時間格式

    //時間:yyyy-MM-dd HH:mm:ss

    String startDateStr = cal.get(Calendar.YEAR) + "-" + (cal.get(Calendar.MONTH)+1)

    + "-" + cal.get(Calendar.DAY_OF_MONTH) + " " + startHours

    + ":" + startMinutes + ":" + startSeconds;

    System.out.println("時間:" + startDateStr);

    }

  • 中秋節和大豐收的關聯?
  • 《灌籃高手》為何神奈川的牧紳一在愛知縣這麼有名氣?