getYear()

Return the year value in this date.

Syntax

public String getYear()
 

Return values

The string representing the year. The year value includes the century. Examples are 1998 and 2004.

Examples

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());
 

See also

getIntYear()

Copyright IBM Corp. 1997, 2003