对于java.lang.Object/java.util.Date对象, hessian序列化时需要写入object/date,此处进行转换

@param type 类名称
@return 转换结果
13140
public static String encodeObjectAndDate(String type) {
        return type.replace(Object.class.getName(), "object").replace(Date.class.getName(), "date");
    }
742754
public Date toDate(Object date) {

        Date d = null;
        if (null != date) {
            if (date instanceof Date) {
                d = (Date)date;
            } else if (date instanceof Long) {
                d = new Date(((Long)date).longValue());
            } else {
                try {
                    long l = Long.parseLong(date.toString());
                    d = new Date(l);
                } catch (Exception e) {
                    // do nothing, just let d remain null
                }
            }
        }
        return d;
    }
1017224
public String formatDate(Date date, int type)
    {
        String string = null;
        if (type == DBConstants.DATE_TIME_FORMAT)
            string = XmlUtilities.dateTimeFormat.format(date);
        else if (type == DBConstants.DATE_ONLY_FORMAT)
            string = XmlUtilities.dateFormat.format(date);
        else if (type == DBConstants.TIME_ONLY_FORMAT)
            string = XmlUtilities.timeFormat.format(date);
        return string;
    }
20097
public static <T extends Comparable<?>> DateOperation<T> dateOperation(Class<? extends T> type,
            Operator operator, Expression<?>... args) {
        return new DateOperation<T>(type, operator, args);
    }
93327
def _get_date_type(date):
        
        if isinstance(date, str):
            return 'str'

        if isinstance(date, datetime.date):
            return 'date'

        if isinstance(date, int):
            return 'int'

        raise ValueError('Unexpected type {0!s}'.format(date.__class__))
194030
public static String formatDate(Date date) {
        return org.apache.http.client.utils.DateUtils.formatDate(date);
    }
217950
public String getMealDesc(Date date)
    {
        if (m_rgstrMeals == null)
            return Constants.BLANK;

        Date startDate = this.getStartDate();
        Converter.initGlobals();    // Make sure calendars are set up
        Calendar calendar = Converter.gCalendar;
        calendar.setTime(startDate);
        calendar.set(Calendar.HOUR_OF_DAY, 0);
        calendar.set(Calendar.MINUTE, 0);
        calendar.set(Calendar.SECOND, 0);
        calendar.set(Calendar.MILLISECOND, 0);
        startDate = calendar.getTime();
        
        calendar.setTime(date);
        calendar.set(Calendar.HOUR_OF_DAY, 0);
        calendar.set(Calendar.MINUTE, 0);
        calendar.set(Calendar.SECOND, 0);
        calendar.set(Calendar.MILLISECOND, 0);
        date = calendar.getTime();
        
        long lTimeToTarget = date.getTime() - startDate.getTime();
        int iTargetDay = (int)(lTimeToTarget / Constants.KMS_IN_A_DAY);   // Day 0 = first day
        if ((iTargetDay < 0) || (iTargetDay >= m_rgstrMeals.length))
            return Constants.BLANK;
        String strMeals = m_rgstrMeals[iTargetDay];
        if (strMeals == null)
            return Constants.BLANK;
        return strMeals;
    }
969857
public Date makeDateFrom( Object obj )
  {
    if( obj == null )
    {
      return null;
    }

    if( obj instanceof IDimension )
    {
      obj = ((IDimension)obj).toNumber();
    }

    if( obj instanceof Date )
    {
      return (Date)obj;
    }

    if( obj instanceof Number )
    {
      return new Date( ((Number)obj).longValue() );
    }

    if( obj instanceof Calendar)
    {
      return ((Calendar)obj).getTime();
    }

    if( !(obj instanceof String) )
    {
      obj = obj.toString();
    }

    try
    {
      return parseDateTime( (String)obj );
    }
    catch( Exception e )
    {
      //e.printStackTrace();
    }

    return null;
  }
412725
function (date, type) {
            var time = date.getTime(),
                d = datepicker.getParsedDate(date),
                min = datepicker.getParsedDate(this.minDate),
                max = datepicker.getParsedDate(this.maxDate),
                dMinTime = new Date(d.year, d.month, min.date).getTime(),
                dMaxTime = new Date(d.year, d.month, max.date).getTime(),
                types = {
                    day: time >= this.minTime && time <= this.maxTime,
                    month: dMinTime >= this.minTime && dMaxTime <= this.maxTime,
                    year: d.year >= min.year && d.year <= max.year
                };
            return type ? types[type] : types.day
        }
82348
public Date getDate(final Date min, final Date max) {
		return getDate(min.getTime(), max.getTime());
	}
813446
public Date getDate(int columnIndex) {
		Object fieldValue = data[columnIndex];
		if (fieldValue == null) {
			return null;
		}
		if (fieldValue instanceof Date) {
			return (Date) fieldValue;
		}
		throw new DBFException(
				"Unsupported type for Date at column:" + columnIndex + " " + fieldValue.getClass().getCanonicalName());
	}
371367
public static TypeCode toTypeCode(Class<?> type) {
		if (type == null)
			return TypeCode.Unknown;
		else if (type.isArray())
			return TypeCode.Array;
		else if (type.isEnum())
			return TypeCode.Enum;
		else if (type.isPrimitive()) {
			if (_booleanType.isAssignableFrom(type))
				return TypeCode.Boolean;
			if (_doubleType.isAssignableFrom(type))
				return TypeCode.Double;
			if (_floatType.isAssignableFrom(type))
				return TypeCode.Float;
			if (_longType.isAssignableFrom(type))
				return TypeCode.Long;
			if (_integerType.isAssignableFrom(type))
				return TypeCode.Integer;
		} else {
			if (_booleanType.isAssignableFrom(type))
				return TypeCode.Boolean;
			if (_doubleType.isAssignableFrom(type))
				return TypeCode.Double;
			if (_floatType.isAssignableFrom(type))
				return TypeCode.Float;
			if (_longType.isAssignableFrom(type))
				return TypeCode.Long;
			if (_integerType.isAssignableFrom(type))
				return TypeCode.Integer;
			if (_stringType.isAssignableFrom(type))
				return TypeCode.String;
			if (_dateTimeType.isAssignableFrom(type))
				return TypeCode.DateTime;
			if (_durationType.isAssignableFrom(type))
				return TypeCode.Duration;
			if (_mapType.isAssignableFrom(type))
				return TypeCode.Map;
			if (_listType.isAssignableFrom(type))
				return TypeCode.Array;
			if (_enumType.isAssignableFrom(type))
				return TypeCode.Enum;
		}

		return TypeCode.Object;
	}
994266
public static String getDateAsIso8601(long date) {

        // Check if date is set
        if ((date > Long.MIN_VALUE) && (date < Long.MAX_VALUE)) {
            final Date d_date = new Date(date);
            return getDateAsIso8601(d_date);
        }
        return null;
    }
1348056
function (type) {
            var ret = null, meth;
            if (isString(type)) {
                ret = this._static.CAST_TYPES[type] || this._super(arguments);
            } else if (type === String) {
                meth += "CHAR";
            } else if (type === Number) {
                meth += "DECIMAL";
            } else if (type === DateTime) {
                meth += "DATETIME";
            } else if (type === Year) {
                meth += "Year";
            } else if (type === Time) {
                meth += "DATETIME";
            } else if (type === Double) {
                meth += "DECIMAL";
            } else {
                ret = this._super(arguments);
            }
            return ret;
        }
647263
private static String formatDate(Object dateObj, String format) {
		if (StrUtil.isNotBlank(format)) {
			final Date date = (dateObj instanceof Date) ? (Date)dateObj : ((Calendar)dateObj).getTime();
			//用户定义了日期格式
			return DateUtil.format(date, format);
		}
		
		//默认使用时间戳
		return String.valueOf((dateObj instanceof Date) ? ((Date)dateObj).getTime() : ((Calendar)dateObj).getTimeInMillis());
	}
917230
public static String formatDate(TimeType timeType, Date date) {
        return getDateFormat(timeType).format(date);
    }
829800
@SuppressWarnings("unchecked")
    public <A extends Comparable<?>> DatePath<A> getDate(String property, Class<A> type) {
        Class<? extends A> vtype = validate(property, type);
        return super.createDate(property, (Class<? super A>) vtype);
    }