Convert a date to the String representation we use in the JSON.
@param d the date to convert
@return the String representation we use in the JSON.
332998
private JSONValue dateToJson(Date d) {

        return null != d ? new JSONString(Long.toString(d.getTime())) : null;
    }
226346
public static String toFtsUtcString(Date date) {
        if (date == null) {
            return null;
        }
        DateFormat rfc3339 = df.get();
        String zDate = rfc3339.format(date);
        String xDate = zDate.replaceFirst("\\+0000$", "Z");
        return xDate;
    }
411855
public static String convert(String date, String format, String newFormat) {
        return getFormatDate(newFormat, parse(date, format));
    }
1288542
public String getDate() {
        SimpleDateFormat formatter = new SimpleDateFormat("MM/dd/yyyy");
        String date = formatter.format(calendar.getTime());

        return date;
    }
864499
@Deprecated
	public static String getDateString(Date date) {
		synchronized(StringUtility.class) {
			calendar.setTime(date);
			int day=calendar.get(Calendar.DATE);
			return (day>=0 && day<=9 ? "0":"")+String.valueOf(calendar.get(Calendar.DATE))+MONTHS[calendar.get(Calendar.MONTH)]+calendar.get(Calendar.YEAR);
		}
	}
98424
public static String toDateString(final Date date) {
        SimpleDateFormat df = RFC1123_PATTERN_FORMAT.get();
        //we always need to set the time zone
        //because date format is stupid, and calling parse() can mutate the timezone
        //see UNDERTOW-458
        df.setTimeZone(GMT_ZONE);
        return df.format(date);
    }
846253
@MapMethod
    public String formatDate(Date d, String format){
        return Objects.formatDate(d, format);
    }
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;
    }
615354
@Deprecated
	public static String getDateStringMMDDYYYY(Date date) {
		if(date==null) return "";
		Calendar C=Calendar.getInstance();
		C.setTime(date);
		int day=C.get(Calendar.DATE);
		int month=C.get(Calendar.MONTH)+1;
		return
			(month>=0 && month<=9 ? "0":"")
			+month
			+(day>=0 && day<=9 ? "0":"")
			+day
			+C.get(Calendar.YEAR)
		;
	}
464359
private String getStrDate(Calendar c)
   {
      int m = c.get(Calendar.MONTH) + 1;
      int d = c.get(Calendar.DATE);
      return "" + c.get(Calendar.YEAR) + (m < 10 ? "0" + m : m) + (d < 10 ? "0" + d : d);
   }
551504
public static String dateToString(final Date date) {

        String result;
        if (date == null) {
            result = "";
        } else {
            result = Z_DATE_FORMAT.format(date);
        }
        return result;
    }
681950
@Override
    public String toJSONString() {
        Gson gson = new GsonBuilder()
                .excludeFieldsWithoutExposeAnnotation()
                //.registerTypeAdapter(Date.class, new DateSerializer())
                //.setDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'")
                .create();
        return gson.toJson(this);
    }
812684
private String getFormattedDate(Date date) {
		String formattedDate = "";
		Calendar cal = Calendar.getInstance();
		cal.setTime(date);
		try {
			formattedDate = ValueFactoryImpl.getInstance().createValue(cal).getString();
		} catch (Exception e) {
			// should never happen
			e.printStackTrace();
		}
		return formattedDate;
	}
889734
@Nonnull
    @SuppressFBWarnings("RV_RETURN_VALUE_IGNORED_BAD_PRACTICE")
    public String format(@Nonnull Date date) {
        SimpleDateFormat dateFormat = dateFormats.poll();
        if (dateFormat == null) {
            dateFormat = new SimpleDateFormat(pattern, locale);
            dateFormat.setTimeZone(timeZone);
        }
        try {
            return dateFormat.format(date);
        } finally {
            dateFormats.offer(dateFormat);
        }
    }
535930
public String marshal( Date value )
    {
        String val = "";
    	if (value != null) {
        	Calendar cal = new GregorianCalendar();
        	cal.setTime( value );
        	return DatatypeConverter.printDateTime( cal );
        }
		
		System.out.println("Date value: " + value);
        return val;
    }
1040503
public static String dateToIsoString(Date inputDate) {
		DateFormat dateStringFormat = new SimpleDateFormat("yyyy-MM-dd");
		return dateStringFormat.format(inputDate);
	}
1345894
public static String unixDateToString(int date) {
		final StringBuilder buf = new StringBuilder(10);
		unixDateToString(buf, date);
		return buf.toString();
	}