Obtains an instance of {@code JapaneseEra} from a date.

@param date  the date, not null
@return the Era singleton, never null
972742
static JapaneseEra from(LocalDate date) {
        if (date.isBefore(MEIJI.since)) {
            throw new DateTimeException("Date too early: " + date);
        }
        JapaneseEra[] known = KNOWN_ERAS.get();
        for (int i = known.length - 1; i >= 0; i--) {
            JapaneseEra era = known[i];
            if (date.compareTo(era.since) >= 0) {
                return era;
            }
        }
        return null;
    }
44574
@Override  // override with covariant return type
    public HijrahDate date(Era era, int yearOfEra, int month, int dayOfMonth) {
        return (HijrahDate) super.date(era, yearOfEra, month, dayOfMonth);
    }
188777
protected OffsetDateTime translateDate(Date date) {
    if (date == null) {
      return null;
    }
    
    return OffsetDateTime.ofInstant(date.toInstant(), ZoneId.systemDefault());
  }
1093646
public static DateValue getInstance(Date date) {
        DateValue result;
        if (date != null) {
            synchronized (cache) {
                result = cache.get(date);
                if (result == null) {
                    result = new DateValue(date);
                    cache.put(date, result);
                }
            }
        } else {
            result = getInstance(new Date());
        }
        return result;
    }
179247
public static Date parseDate(final String date) {

        /*
            IE9 sends a superflous lenght parameter after date in the
            If-Modified-Since header, which needs to be stripped before
            parsing.

         */

        final int semicolonIndex = date.indexOf(';');
        final String trimmedDate = semicolonIndex >= 0 ? date.substring(0, semicolonIndex) : date;

        ParsePosition pp = new ParsePosition(0);
        SimpleDateFormat dateFormat = RFC1123_PATTERN_FORMAT.get();
        dateFormat.setTimeZone(GMT_ZONE);
        Date val = dateFormat.parse(trimmedDate, pp);
        if (val != null && pp.getIndex() == trimmedDate.length()) {
            return val;
        }

        pp = new ParsePosition(0);
        dateFormat = new SimpleDateFormat(RFC1036_PATTERN, LOCALE_US);
        dateFormat.setTimeZone(GMT_ZONE);
        val = dateFormat.parse(trimmedDate, pp);
        if (val != null && pp.getIndex() == trimmedDate.length()) {
            return val;
        }

        pp = new ParsePosition(0);
        dateFormat = new SimpleDateFormat(ASCITIME_PATTERN, LOCALE_US);
        dateFormat.setTimeZone(GMT_ZONE);
        val = dateFormat.parse(trimmedDate, pp);
        if (val != null && pp.getIndex() == trimmedDate.length()) {
            return val;
        }

        pp = new ParsePosition(0);
        dateFormat = new SimpleDateFormat(OLD_COOKIE_PATTERN, LOCALE_US);
        dateFormat.setTimeZone(GMT_ZONE);
        val = dateFormat.parse(trimmedDate, pp);
        if (val != null && pp.getIndex() == trimmedDate.length()) {
            return val;
        }

        return null;
    }
355097
public static String getDateAsIso8601(Date date) {

        synchronized (CmsSearchUtil.class) {
            if (DATEFORMAT_ISO_8601.getTimeZone() != TIMEZONE_UTC) {
                DATEFORMAT_ISO_8601.setTimeZone(TIMEZONE_UTC);
            }
            return DATEFORMAT_ISO_8601.format(date);
        }
    }
1053361
public static Date toDate(LocalDate date)
	{
		if(date == null)
			return null;
		
		return  java.util.Date
	      .from(date.atStartOfDay(ZoneId.systemDefault())
	      .toInstant());
	}
1315565
public static Date getFirstDateOfSeason(Date date) {

        if (date == null)
            return null;

        return getFirstDateOfMonth(getSeasonDate(date)[0]);
    }
571953
public static function instance($date)
    {
        if ($date instanceof static) {
            return clone $date;
        }

        static::expectDateTime($date);

        return new static($date->format('Y-m-d H:i:s.u'), $date->getTimezone());
    }
598399
public static Date getLastDateOfSeason(Date date) {

        if (date == null)
            return null;

        return getLastDateOfMonth(getSeasonDate(date)[2]);
    }
133313
public static Calendar getCalendarInstance(final Date date) {
        Calendar instance;
        if (date instanceof DateTime) {
            final DateTime dateTime = (DateTime) date;
            if (dateTime.getTimeZone() != null) {
                instance = Calendar.getInstance(dateTime.getTimeZone());
            }
            else if (dateTime.isUtc()) {
                instance = Calendar.getInstance(TimeZones.getUtcTimeZone());
            }
            else {
            	// a date-time without a timezone but not UTC is floating
                instance = Calendar.getInstance();
            }
        }
        else {
            instance = Calendar.getInstance(TimeZones.getDateTimeZone());
        }
        return instance;
    }
67015
public Era getEra(final Locale locale) {
        
        if(locale == null) {
            return Era.UNKNOWN_ERA;
        }
        
        if(eras.containsKey(locale)) {
            return eras.get(locale);
        }
        
        MessageResource resource = messageResolver.loadResource(locale);
        
        // 該当する時代情報の定義のメッセージプロパティが存在するか。
        final Era era;
        if(resource.isNullObject()) {
            era = Era.UNKNOWN_ERA;
        } else {
            era = createEra(resource);
        }
        
        eras.put(locale, era);
        
        return era;
        
    }
252348
public static Date parse(String date, String pattern) {
		return DateTimeFormat.forPattern(pattern).parseDateTime(date).toDate();
	}
775550
public JKTimeObject toTimeObject(Date date, Date time) {
		JKTimeObject fsTimeObject = new JKTimeObject();
		Calendar timeInstance = Calendar.getInstance();
		timeInstance.setTimeInMillis(time.getTime());
		fsTimeObject.setHour(timeInstance.get(Calendar.HOUR_OF_DAY));
		fsTimeObject.setMunite(timeInstance.get(Calendar.MINUTE));

		Calendar dateInstance = Calendar.getInstance();
		dateInstance.setTime(date);
		fsTimeObject.setYear(dateInstance.get(Calendar.YEAR));
		fsTimeObject.setMonth(dateInstance.get(Calendar.MONTH));
		fsTimeObject.setDay(dateInstance.get(Calendar.DAY_OF_MONTH));
		return fsTimeObject;
	}
1214026
public static Date getInstance(final java.util.Date date, final Value type) {
        if (Value.DATE.equals(type)) {
            return new Date(date);
        }
        return new DateTime(date);
    }
1055556
public static DateTime date(Date date) {
		if (date instanceof DateTime) {
			return (DateTime) date;
		}
		return dateNew(date);
	}
105771
@Override  // override with covariant return type
    public JapaneseDate date(TemporalAccessor temporal) {
        if (temporal instanceof JapaneseDate) {
            return (JapaneseDate) temporal;
        }
        return new JapaneseDate(LocalDate.from(temporal));
    }