Returns the formatted object for the given cell.
@param o The value of the cell
@param dateFormat The date format to use if the cell contains a date
@return The formatted object for the given cell
182490
public String getValue(Object o, String dateFormat)
    {
        String ret = "null";
        if(o != null)
        {
            if(o instanceof java.lang.Number)
            {
                ret = o.toString();
                if(type == NO_TYPE)
                    type = NUMBER_TYPE;
                if(inputType != NO_TYPE)
                    ret = convert(ret, dateFormat);
            }
            else if(o instanceof java.lang.Boolean)
            {
                ret = o.toString();
                if(type == NO_TYPE)
                    type = BOOLEAN_TYPE;
            }
            else if(o instanceof Date)
            {
                Date dt = (Date)o;
                ret = Long.toString(dt.getTime());
                if(type == NO_TYPE)
                    type = DATETIME_TYPE;
                if(format.length() == 0)
                    format = new String(dateFormat);
            }
            else
            {
                ret = o.toString().trim();
                if(type == NO_TYPE)
                    type = STRING_TYPE;
                if(!(o instanceof String))
                    logger.severe("invalid file column type="+o.getClass().getName());
                if(inputType != NO_TYPE)
                    ret = convert(ret, dateFormat);
            }
        }
        else // Cell contains null
        {
            // Replace null item with default string
            if(nullValue != null)
                ret = new String(nullValue);
        }

        return ret;
    }
240163
public static String getFormattedDate(final Long lastQueryDate, final String datePattern) {
        return formatDate(lastQueryDate, null, datePattern);
    }
227695
public String getDateString(Date dateTarget, int iDateFormat)
    {
        stringBuffer.setLength(0);
        FieldPosition fieldPosition = new FieldPosition(iDateFormat);
        String string = null;
        string = dateFormat.format(dateTarget, stringBuffer, fieldPosition).toString();
        int iBegin = fieldPosition.getBeginIndex();
        int iEnd = fieldPosition.getEndIndex();
        string = string.substring(iBegin, iEnd);
        return string;
    }
1099738
public static Date autoParseDateFormat(String dateString) {
		// STEP 1: try to detect standard locale based java date format
		for (Locale locale : DateFormat.getAvailableLocales()) {
			for (int style = DateFormat.FULL; style <= DateFormat.SHORT; style++) {
				DateFormat df = DateFormat.getDateInstance(style, locale);
				try {
					return df.parse(dateString);
					// either return "true", or return the Date obtained Date
					// object
				} catch (ParseException ex) {
					continue; // unparsable, try the next one
				}
			}
		}

		// STEP 2: if the date format was not found, check with predefined dates
		String format = determineDateFormat(dateString);
		if (format != null) {
			DateFormat df = new SimpleDateFormat(format);
			try {
				return df.parse(dateString);
			} catch (ParseException e) {
				return null;
			}
		}
		return null;
	}
973927
public SimpleDateFormat getFormat(String format)
    {
        SimpleDateFormat f = (SimpleDateFormat)get();
        f.applyPattern(format);
        return f;
    }
944086
public static CellValue fromObject(final Object o) {
		if (o == null)
			return new VoidValue();
		else if (o instanceof String)
			return new StringValue((String) o);
		else if (o instanceof Number) // BigDecimal, Byte, Short, Integer,
										// Long, Float, Double
			return new FloatValue((Number) o);
		else if (o instanceof Boolean)
			return new BooleanValue((Boolean) o);
		else if (o instanceof Date) // java.util.Date & java.sql.Date,
									// java.sql.Time, java.sql.Timestamp
			return new DateValue((Date) o);
		else if (o instanceof Calendar)
			return new DateValue(((Calendar) o).getTime());
		else // Byte[], ...
			return new StringValue(o.toString());
	}
214830
public static String format(Date date, DatePrinter format) {
		if (null == format || null == date) {
			return null;
		}
		return format.format(date);
	}
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());
	}
998648
public String formatDate(Date d) {
        if (d == null) return null;
        JsDate jsd = JsDate.create(d.getTime());
        return internFormat(input.getElement(), getActiveDateFormat(), jsd);
    }
290512
public static String format(Object data) {

        if (data == null) {
            return null;
        }
        Class<?> clazz = data.getClass();
        if (clazz.equals(Date.class)) {
            return format(((Date)data).getTime());
        }
        return data.toString();
    }
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;
    }
1110153
public static String formatDate(java.util.Date pDate, String format) {

        if (pDate == null) {
            pDate = new java.util.Date();
        }
        SimpleDateFormat sdf = new SimpleDateFormat(format);
        return sdf.format(pDate);
    }
1093235
public static String currentDate(String dateFormat, TestContext context) {
        return new CurrentDateFunction().execute(Collections.singletonList(dateFormat), context);
    }
228539
@SuppressWarnings({ "rawtypes", "unchecked" })
	public static String getObjectString(Object o) {

		if (isBasicType(o)) {
			return o.toString();
		} else if (o.getClass().isArray()) {
			return getArrayValue((Object[]) o);
		} else if (o instanceof Iterable) {
			Iterable itrPropertie = (Iterable) o;
			return getItrValue(itrPropertie);
		} else if (o instanceof Map) {
			return getOrderedMapString((Map) o);
		} else if (o instanceof Date) {
			return getTimestampValue((Date)o);
		} else {
			return getComlpexObjectOrderedString(o);
		}
	}
1241476
public static String format(Date date) {
        DateFormat dateFormat = new SimpleDateFormat(DateField.FORMAT);
        return date == null ? null : dateFormat.format(date);
    }
842358
private String formatCell(Cell cell) {
        lock.lock();
        try {
            return dataFormatter.formatCellValue(cell);
        } finally {
            lock.unlock();
        }
    }
404873
static String retriveCellValue(Cell cell) {
        String cellValue = "";
        if (cell == null) {
            return cellValue;
        }
        try {
            switch (cell.getCellType()) {
                case Cell.CELL_TYPE_NUMERIC:
                    if (CellDateFormat.isDateCell(cell)) {
                        Date date = cell.getDateCellValue();
                        DateFormat dateFormat = CellDateFormat
                                .getFormat(cell.getCellStyle().getDataFormat()).getDateFormat();
                        cellValue = dateFormat.format(date);
                    } else {
                        cellValue = roundValue(cell.getNumericCellValue());
                    }
                    break;
                case Cell.CELL_TYPE_FORMULA:
                    cellValue = roundValue(cell.getSheet().getWorkbook().getCreationHelper()
                            .createFormulaEvaluator().evaluate(cell).formatAsString());
                    break;
                default:
                    cellValue = cell.getStringCellValue();
            }
        } catch (Exception e) {
            LOG.warn(MessageManager.getMessage("cell.fail"), cell.getRowIndex(),
                    cell.getColumnIndex(), e.getMessage());
        }

        return cellValue;
    }