}
@Override
public String toString() {
if(_canonical == null) {
final DateTimeBaseType targetType = getDateTimeType();
final boolean settime = targetType.isTimeSet();
if(settime) {
final int hour = value.getHour();
if(hour == 24 && value.getMinute() == 0 && value.getSecond() == 0) {
// 2004-03-31T24:00:00" => "2004-04-01T00:00:00"
value.add(XsDatatypeFactory.getDatatypeFactory().newDuration(true, 0, 0, 0, 0, 0, 1));
value.setSecond(0);
}
}
final StringBuilder buf = new StringBuilder(128);
if(targetType.isDateSet()) {
final boolean yset = targetType.isYearSet();
final boolean mset = targetType.isMonthSet();
final boolean dset = targetType.isDaySet();
if(yset) {
final int year = value.getYear();
if(year != DatatypeConstants.FIELD_UNDEFINED) {
if(year == 0) {// There is no year 0, and '0000' is not a valid lexical representation
appendPaddedZeros(1, 4, buf);