Search in sources :

Example 1 with ExtendedDateFormat

use of org.jkiss.utils.time.ExtendedDateFormat in project dbeaver by serge-rider.

the class DateTimeDataFormatter method init.

@Override
public void init(Locale locale, Map<Object, Object> properties) {
    pattern = CommonUtils.toString(properties.get(PROP_PATTERN));
    dateFormat = new ExtendedDateFormat(pattern, locale);
    buffer = new StringBuffer();
    position = new FieldPosition(0);
}
Also used : ExtendedDateFormat(org.jkiss.utils.time.ExtendedDateFormat) FieldPosition(java.text.FieldPosition)

Example 2 with ExtendedDateFormat

use of org.jkiss.utils.time.ExtendedDateFormat in project dbeaver by dbeaver.

the class DateTimeDataFormatter method init.

@Override
public void init(DBSTypedObject type, Locale locale, Map<Object, Object> properties) {
    pattern = CommonUtils.toString(properties.get(PROP_PATTERN));
    dateFormat = new ExtendedDateFormat(pattern, locale);
    buffer = new StringBuffer();
    position = new FieldPosition(0);
}
Also used : ExtendedDateFormat(org.jkiss.utils.time.ExtendedDateFormat) FieldPosition(java.text.FieldPosition)

Example 3 with ExtendedDateFormat

use of org.jkiss.utils.time.ExtendedDateFormat in project dbeaver by serge-rider.

the class DateTimeDataFormatter method init.

@Override
public void init(DBSTypedObject type, Locale locale, Map<String, Object> properties) {
    pattern = CommonUtils.toString(properties.get(PROP_PATTERN));
    dateFormat = new ExtendedDateFormat(pattern, locale);
    // We shouldn't use lanient formatter (#7244)
    dateFormat.setLenient(false);
    buffer = new StringBuffer();
    position = new FieldPosition(0);
    // DateTimeFormatter pattern for nanoseconds is "n" but old "f" (ExtendedDateFormat)
    String java8DatePattern = pattern.replaceAll("f+", "n");
    dateTimeFormatter = DateTimeFormatter.ofPattern(java8DatePattern);
}
Also used : ExtendedDateFormat(org.jkiss.utils.time.ExtendedDateFormat) FieldPosition(java.text.FieldPosition)

Aggregations

FieldPosition (java.text.FieldPosition)3 ExtendedDateFormat (org.jkiss.utils.time.ExtendedDateFormat)3