getYear()

この日付の年の値を戻します。

構文

public String getYear()
 

戻り値

年を表すストリング。年の値には世紀が含まれます。例えば、1998 や 2004 です。

DtpDate toDay = new DtpDate();
 DtpDate lastYear= toDay.addYears(-1);
 System.out.println("Next month is "
    + lastYear.getDayOfMonth() + "/"
    + lastYear.getNumericMonth() + "/"
    + lastYear.getYear() + " "
    + lastYear.getHours() + ":"
    + lastYear.getMinutes() + ":"
    + lastYear.getSeconds());
 

参照項目

getIntYear()

Copyright IBM Corp. 2004