20141027: same as getDateTimeStrConcise but no timezone.

@param d
the d
@return the date time str concise no zone
5161
public static String getDateTimeStrConciseNoZone(Date d) {
        if (d == null)
            return "";

        SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmssSSS");
        return sdf.format(d);
    }
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);
        }
    }
67581
public static String formatDate(Instant d) {
    return d.atZone(ZoneId.systemDefault()).toLocalDate().toString();
  }
1163318
public static Date convertTimeToDate(Date time)
    {
        if (time != null)
        {
            DataConverters.initGlobals();
            Calendar calendar = DataConverters.gCalendar;
            calendar.setTime(time);
            calendar.set(Calendar.HOUR_OF_DAY, 0);
            calendar.set(Calendar.MINUTE, 0);
            calendar.set(Calendar.SECOND, 0);
            calendar.set(Calendar.MILLISECOND, 0);
            time = calendar.getTime();
        }       
        return time;
    }
640702
private String getDateTimeString(Date value)
   {
      String result = null;
      if (value != null)
      {
         Calendar cal = DateHelper.popCalendar(value);
         StringBuilder sb = new StringBuilder(16);
         sb.append(m_fourDigitFormat.format(cal.get(Calendar.YEAR)));
         sb.append(m_twoDigitFormat.format(cal.get(Calendar.MONTH) + 1));
         sb.append(m_twoDigitFormat.format(cal.get(Calendar.DAY_OF_MONTH)));
         sb.append('T');
         sb.append(m_twoDigitFormat.format(cal.get(Calendar.HOUR_OF_DAY)));
         sb.append(m_twoDigitFormat.format(cal.get(Calendar.MINUTE)));
         sb.append(m_twoDigitFormat.format(cal.get(Calendar.SECOND)));
         sb.append('Z');
         result = sb.toString();
         DateHelper.pushCalendar(cal);
      }
      return result;
   }
397275
static ZonedDateTime getDateFromStringToZoneId(String date, ZoneId zoneId) throws DateTimeParseException {
        ZonedDateTime usDate = ZonedDateTime.parse(date).withZoneSameInstant(ZoneId.of(Constants.SHERDOG_TIME_ZONE));
        return usDate.withZoneSameInstant(zoneId);
    }
28268
private static long dosToJavaTime(long dtime) {
        Date d = new Date((int)(((dtime >> 25) & 0x7f) + 80),
                          (int)(((dtime >> 21) & 0x0f) - 1),
                          (int)((dtime >> 16) & 0x1f),
                          (int)((dtime >> 11) & 0x1f),
                          (int)((dtime >> 5) & 0x3f),
                          (int)((dtime << 1) & 0x3e));
        return d.getTime();
    }
1006372
public T toDateTime(DateTime dateTime) {
    try {
      D dateObj = dateClass.newInstance();
      PropertyUtils.setProperty(dateObj, "year", dateTime.getYear());
      PropertyUtils.setProperty(dateObj, "month", dateTime.getMonthOfYear());
      PropertyUtils.setProperty(dateObj, "day", dateTime.getDayOfMonth());

      T dateTimeObj = dateTimeClass.newInstance();
      PropertyUtils.setProperty(dateTimeObj, "date", dateObj);
      PropertyUtils.setProperty(dateTimeObj, "hour", dateTime.getHourOfDay());
      PropertyUtils.setProperty(dateTimeObj, "minute", dateTime.getMinuteOfHour());
      PropertyUtils.setProperty(dateTimeObj, "second", dateTime.getSecondOfMinute());
      // Starting in v201811, timeZoneID was renamed to timeZoneId
      if (PropertyUtils.isWriteable(dateTimeObj, "timeZoneID")) {
        PropertyUtils.setProperty(
            dateTimeObj, "timeZoneID", dateTime.getZone().toTimeZone().getID());
      } else {
        PropertyUtils.setProperty(
            dateTimeObj, "timeZoneId", dateTime.getZone().toTimeZone().getID());
      }

      return dateTimeObj;
    } catch (InstantiationException e) {
      throw new IllegalStateException("Could not instantiate class.", e);
    } catch (IllegalAccessException e) {
      throw new IllegalStateException("Could not instantiate class.", e);
    } catch (InvocationTargetException e) {
      throw new IllegalStateException("Could not set field.", e);
    } catch (NoSuchMethodException e) {
      throw new IllegalStateException("Could not set field.", e);
    }
  }
104826
public static String getDateTimeStr(Date d) {
        if (d == null)
            return "";

        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSSZ");
        // 20140315 test will problem +0000
        return sdf.format(d);
    }
649792
def date_to_datetime(d):
    
    if not isinstance(d, datetime):
        d = datetime.combine(d, datetime.min.time())
    return d
829910
public static Calendar getTimeFromIso8601String(String isoDateStr)
			throws DatatypeConfigurationException {
		Calendar retCal = Calendar.getInstance(TimeZone.getTimeZone("UTC"));
		retCal.setTime(DatatypeFactory.newInstance()
				.newXMLGregorianCalendar(isoDateStr)
				.toGregorianCalendar().getTime());
		return retCal;
	}
778944
static public String getFormattedTime(long dt, String format, boolean isTime)
    {
        String ret = "";
        SimpleDateFormat df = null;

        try
        {
            if(dt > 0)
            {
                df = formatPool.getFormat(format);
                if(isTime)
                    df.setTimeZone(DateUtilities.getCurrentTimeZone());
                else
                    df.setTimeZone(DateUtilities.defaultTZ);
                ret = df.format(new Date(dt));
            }
        }
        catch(Exception e)
        {
        }

        if(df != null)
            formatPool.release(df);

        return ret;
    }
670730
public static String getDateTime(Date date, Format format) {

        StringBuffer buf = new StringBuffer();
        buf.append(getDate(date, format));
        buf.append(" ");
        buf.append(getTime(date, format));
        return buf.toString();
    }
1257104
public static String dateTime(Date date) {
		GregorianCalendar gc = new GregorianCalendar();
		gc.setTime(date);
		return dateTime(gc);
	}
1209671
public static DateTime toDateTime(Locale locale, String str, TimeZone tz, boolean useCommomDateParserAsWell) throws PageException {

	DateTime dt = toDateTime(locale, str, tz, null, useCommomDateParserAsWell);
	if (dt == null) {
	    String prefix = locale.getLanguage() + "-" + locale.getCountry() + "-";
	    throw new ExpressionException("can't cast [" + str + "] to date value",
		    "to add custom formats for " + LocaleFactory.toString(locale) + ", create/extend on of the following files [" + prefix + "datetime.df (for date time formats), "
			    + prefix + "date.df (for date formats) or " + prefix + "time.df (for time formats)] in the following directory [<context>/lucee/locales]." + "");

	    // throw new ExpressionException("can't cast ["+str+"] to date value");
	}
	return dt;
    }
446042
static public String getFormattedDate(long dt)
    {
        String ret = "";
        SimpleDateFormat df = null;

        try
        {
            if(dt > 0)
            {
                df = formatPool.getFormat(DATE_FORMAT);
                df.setTimeZone(DateUtilities.getCurrentTimeZone());
                ret = df.format(new Date(dt));
            }
        }
        catch(Exception e)
        {
        }

        if(df != null)
            formatPool.release(df);

        return ret;
    }
1122585
def fmt_datetime(d, fmt='', local=True):
    
    if not d:
        return ''
    if local:
        from django.templatetags.tz import localtime
        d = localtime(d)
    if not fmt:
        fmt = '%Y-%m-%d %H-%M'
    return d.strftime(fmt)