亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

添加或子日歷

添加或子日歷

偶然的你 2023-08-09 15:34:26
我可以通過使用像日期 5-6-2018 到 26-9-2018 這樣的參數來使用日歷嗎?我正在尋找很多解決方案,但我沒有得到,我需要幫助完成我的作業不在乎 31 天或 30 天或閏年,只是我需要如何做public Date(int day, int month, int year) {  this.day = day;  this.month=month;  this.year=year;}public void setDay(int day) {        this.day = day;    }    public void setmonth(int month) {        this.month = month;  }    public void setYear(int year) {        this.year = year;      } public int getDay() {        return day;    }    public int getMonth() {        return month;    }    public int getYear() {        return year;    }
查看完整描述

1 回答

?
子衿沉夜

TA貢獻1828條經驗 獲得超3個贊

最后我很容易地解決了T_T,我花了兩周的時間來解決


 public Date1(int d, int m, int y) {


        this.day = d;

        this.month = m;

        this.year = y;

    }




  public void addDay() {

    month--;

    Calendar m = Calendar.getInstance();

    m.set(year, month, day);

    m.add(day, 5);


    java.sql.Date d = new java.sql.Date(m.getTimeInMillis());

    DateFormat df = new SimpleDateFormat("dd/MM/yyyy");

    System.out.println(" date is  " + df.format(d));


}


查看完整回答
反對 回復 2023-08-09
  • 1 回答
  • 0 關注
  • 133 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號