Return an reader friendly date from ISO 8601 combined date and time string.

@param dateISOString
String for date in ISO format.
@return String with format "yyyy-MM-dd'T'HH:mm:ss.SSS+XXXX where XXXX corresponds to the host's time zone."
518271
public static String getStringFromISODateString(String dateISOString) {
        Date date;
        String formattedDate;
        DateFormat formatter = getFormatter();
        try {
            date = formatter.parse(dateISOString);
            formattedDate = DateFormat.getDateTimeInstance(DateFormat.MEDIUM, DateFormat.SHORT).format(date);
        } catch (ParseException e) {
            logger.log(Level.WARNING, e.getMessage(), e);
            formattedDate = dateISOString;
        }
        return formattedDate;
    }
1067002
def from_ISO_8601(cls, date_string, time_string, tz_string):
        
        # parse tz_string
        if tz_string:
            tz_offset = (int(tz_string[1:3]) * 60) + int(tz_string[3:])
            if tz_string[0] == '-':
                tz_offset = -tz_offset
        else:
            tz_offset = None
        if time_string == '000000':
            # assume no time information
            time_string = ''
            tz_offset = None
        datetime_string = date_string + time_string[:13]
        precision = min((len(datetime_string) - 2) // 2, 7)
        if precision <= 0:
            return None
        fmt = ''.join(('%Y', '%m', '%d', '%H', '%M', '%S', '.%f')[:precision])
        return cls(
            (datetime.strptime(datetime_string, fmt), precision, tz_offset))
45221
public static Date fromISODateTime(final String val) throws BadDateException {
    try {
      synchronized (isoDateTimeFormat) {
        try {
          isoDateTimeFormat.setTimeZone(Timezones.getDefaultTz());
        } catch (TimezonesException tze) {
          throw new RuntimeException(tze);
        }
        return isoDateTimeFormat.parse(val);
      }
    } catch (Throwable t) {
      throw new BadDateException();
    }
  }
1028893
public static Date parseISO8601Date(String dateString) {
        try {
            return doParseISO8601Date(dateString);
        } catch(RuntimeException ex) {
            throw handleException(ex);
        }
    }
1324199
public static Date stringToDate(String strString, int ibScale) throws Exception
    {
        Date objData;
        Exception except = null;
        initGlobals();      // Make sure you have the utilities
        if ((strString == null) || (strString.equals(Constant.BLANK)))
            return null;
        for (int i = 1; i <= 6; i++)
        {
            DateFormat df = null;
            switch (i)
            {
            case 1:
                df = gDateTimeFormat;break;
            case 2:
                df = gDateShortTimeFormat;break;
            case 3:
                df = gDateFormat;break;
            case 4:
                df = gDateShortFormat;break;
            case 5:
            default:
                df = gTimeFormat;break;
            case 6:
                df= gGMTDateTimeFormat;break;
            }
            try   {
                synchronized (gCalendar)
                {
                    objData = df.parse(strString);
                    if (ibScale != -1)
                    {
                        DataConverters.gCalendar.setTime(objData);
                        if (ibScale == Constant.DATE_ONLY)
                        {
                            DataConverters.gCalendar.set(Calendar.HOUR_OF_DAY, 0);
                            DataConverters.gCalendar.set(Calendar.MINUTE, 0);
                            DataConverters.gCalendar.set(Calendar.SECOND, 0);
                            DataConverters.gCalendar.set(Calendar.MILLISECOND, 0);
                        }
                        if (ibScale == Constant.TIME_ONLY)
                        {
                            DataConverters.gCalendar.set(Calendar.YEAR, Constant.FIRST_YEAR);
                            DataConverters.gCalendar.set(Calendar.MONTH, Calendar.JANUARY);
                            DataConverters.gCalendar.set(Calendar.DATE, 1);
                        }
                        DataConverters.gCalendar.set(Calendar.MILLISECOND, 0);
                        objData = DataConverters.gCalendar.getTime();
                    }
                }
                return objData;
            } catch (ParseException ex)   {
                except = ex;
                // continue with the next parse
            }
        }
        if (except != null)
            throw except;
        return null;
    }
761192
public static String getDateStr(Date date) {
        java.text.SimpleDateFormat sdf = new java.text.SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        return sdf.format(date);
    }
954340
public static Date parseTimestamp(@Nullable String string) {
        Date date = null;
        try {
            if (string != null) {
                date = ISO8601Utils.parse(string, new ParsePosition(0));
            }
        } catch (ParseException e) {
            throw Throwables.propagate(e);
        }
        return date;
    }
342603
public static DateTime iso8601DateTimeFromString(String dateTimeString) {
        try {
            return DateTime.parse(dateTimeString, ISO8601_DATE_TIME_FORMATTER);
        } catch (Exception e) {
            return null;
        }
    }
532605
public static String format( Date date ) {
        return format( DateFormat.DATE_FORMAT_STR_ISO8601, DateFormat.UTC_TIMEZONE, date );
    }
746255
public static Calendar parse(String dateString) throws ValueFormatException
   {
      try
      {
         return ISO8601.parseEx(dateString);
      }
      catch (ParseException e)
      {
         throw new ValueFormatException("Can not parse date from [" + dateString + "]", e);
      }
      catch (NumberFormatException e)
      {
         throw new ValueFormatException("Can not parse date from [" + dateString + "]", e);
      }
   }
895885
function getIso8601String(timeMs) {
  var time = new Date();
  time.setTime(timeMs);
  return '' +
      time.getUTCFullYear() + '-' +
      leftPadNumber(time.getUTCMonth() + 1, 2, '0') + '-' +
      leftPadNumber(time.getUTCDate(), 2, '0') + 'T' +
      leftPadNumber(time.getUTCHours(), 2, '0') + ':' +
      leftPadNumber(time.getUTCMinutes(), 2, '0') + ':' +
      leftPadNumber(time.getUTCSeconds(), 2, '0') + 'Z';
}
827279
public static Date stringToDate(String dateString) {
        if (!"".equals(dateString) && dateString != null) {
            // ISO_DATE_FORMAT = "yyyyMMdd";
            if (dateString.trim().length() == 8) {
                return stringToDate(dateString, ISO_DATE_FORMAT, LENIENT_DATE);
            } else if (dateString.trim().length() == 10) {
                // ISO_EXPANDED_DATE_FORMAT = "yyyy-MM-dd";
                return stringToDate(dateString, ISO_EXPANDED_DATE_FORMAT,
                        LENIENT_DATE);
            } else if (dateString.trim().length() == 19) {
                // DATETIME_PATTERN = "yyyy-MM-dd hh:mm:ss";
                return stringToDate(dateString, DATETIME_PATTERN, LENIENT_DATE);
            } else if (dateString.trim().length() == 11) {
                // CHINESE_EXPANDED_DATE_FORMAT = "yyyy年MM月dd日";
                return stringToDate(dateString, CHINESE_EXPANDED_DATE_FORMAT,
                        LENIENT_DATE);
            }
        }
        return null;
    }
1078157
public static String gpsWeekTime2ISO8601( double gpsWeekTime ) {
        DateTime gps2unix = gpsWeekTime2DateTime(gpsWeekTime);
        return gps2unix.toString(ISO8601Formatter);
    }
1204001
private static String getDateString(Date date) {
		SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS");
		return "'" + df.format(date) + "'";
	}
577196
public static String isoDateTime(final Date val, final TimeZone tz) {
    synchronized (isoDateTimeTZFormat) {
      isoDateTimeTZFormat.setTimeZone(tz);
      return isoDateTimeTZFormat.format(val);
    }
  }
1243253
def CopyToDateTimeStringISO8601(self):
    
    date_time_string = self.CopyToDateTimeString()
    if date_time_string:
      date_time_string = date_time_string.replace(' ', 'T')
      date_time_string = '{0:s}Z'.format(date_time_string)
    return date_time_string
1232496
public static String isoDate(final Date val) {
    synchronized (isoDateFormat) {
      try {
        isoDateFormat.setTimeZone(Timezones.getDefaultTz());
      } catch (TimezonesException tze) {
        throw new RuntimeException(tze);
      }
      return isoDateFormat.format(val);
    }
  }