public java.util.Date asUtilDate()

	{
		try {
			if (isNull()) {
				return null;
			} else if (isUtilDate()) {
				return (java.util.Date) value;
			}

			Calendar cal = Calendar.getInstance();

			if (isTimestamp()) {
				Timestamp ts = (Timestamp) value;
				long date = ts.getTime();
				int nanos = ts.getNanos();

				return new java.util.Date(date + (nanos / 1000000));
			} else if (isTime()) {
				cal.setTime((Time) value);

				return java.sql.Date.valueOf(cal.get(Calendar.YEAR) + "-" + leadingZero(cal.get(Calendar.MONTH) + 1) + "-"
						+ leadingZero(cal.get(Calendar.DAY_OF_MONTH)));
			} else if (isUtilDate()) {
				cal.setTime((java.util.Date) value);

				return java.sql.Date.valueOf(cal.get(Calendar.YEAR) + "-" + leadingZero(cal.get(Calendar.MONTH) + 1) + "-"
						+ leadingZero(cal.get(Calendar.DAY_OF_MONTH)));
			} else if (isString()) {
                return DateUtils.getDateFromFormatOfString((String) value);
            } else {
				return null;
			}
		} catch (IllegalArgumentException a) {
			throw new SwingObjectRunException( a, ErrorSeverity.SEVERE, FrameFactory.class);
		} catch (Exception b) {
			throw new SwingObjectRunException( b, ErrorSeverity.SEVERE, FrameFactory.class);
		}
	}