List of utility methods to do Date to String
String | dateToTimeString(Date date) return time value only of specified date in format: HH:mm:ss return dateToStringWithPattern(date, "HH:mm:ss"); |
Date | dateToUTCDate(Date d) date To UTC Date String strDate = ""; GregorianCalendar calendar = new GregorianCalendar(); calendar.setTime(d); int utcOffsetInMinutes = -(calendar.get(Calendar.ZONE_OFFSET) + calendar.get(Calendar.DST_OFFSET)) / (60 * 1000); calendar.add(Calendar.MINUTE, utcOffsetInMinutes); SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'"); return calendar.getTime(); ... |
String | dateToUtcString(Date date) Transform given Date into String using pattern yyyy-MM-dd'T'HH:mm:ss'Z'. final SimpleDateFormat sdf = new SimpleDateFormat(DATE_AND_TIME_FORMATS[0]); sdf.setTimeZone(TZ_UTC); return sdf.format(date); |
String | dateToW3c(Date d) Convert a Date to a W3C String. String ret = theW3cFormat.format(d);
return ret;
|
String | dateToW3CDTF(Date date) date To WCDTF SimpleDateFormat w3cdtf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ"); String s = w3cdtf.format(date); int index = s.length() - 2; return s.substring(0, index) + ":" + s.substring(index); |
String | dateToW3CDTF(Date date) Creates a String that represents the Date passed to it in W3C Date and Time Format. String s = w3cdtf.get().format(date); int index = s.length() - 2; return s.substring(0, index) + ":" + s.substring(index); |
String | dateToyyyyMMddHHmmss(Date date) date Toyyyy M Mdd H Hmmss java.text.DateFormat df = new java.text.SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); return df.format(date); |