All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.weavechain.core.encoding.FormatUtils Maven / Gradle / Ivy

There is a newer version: 1.3
Show newest version
package com.weavechain.core.encoding;

import java.time.format.DateTimeFormatter;

public class FormatUtils {

    public final static String DATE_FORMAT = "yyyy-MM-dd HH:mm:ss[.SSSSSS][.SSSSS][.SSSS][.SSS][.SS][.S]";

    public final static String ISO_DATE_FORMAT = "yyyy-MM-dd'T'HH:mm:ss[.SSSSSS][.SSSSS][.SSSS][.SSS][.SS][.S][Z]";

    public final static String ISO_DATE_FORMAT_OFFSET = "yyyy-MM-dd'T'HH:mm:ss[.SSSSSS][.SSSSS][.SSSS][.SSS][.SS][.S][xxx][xx][X]";

    public final static String DATE_FORMAT_OUT = "yyyy-MM-dd HH:mm:ss.SSS";

    public final static String DATE_FORMAT_OUT_SEC = "yyyy-MM-dd HH:mm:ss";

    public final static String DAY_FORMAT = "yyyy-MM-dd";

    public static ThreadLocal FMT_DATE_FORMAT = new ThreadLocal() {
        @Override
        protected DateTimeFormatter initialValue() {
            return DateTimeFormatter.ofPattern(DATE_FORMAT);
        }
    };

    public static ThreadLocal FMT_DAY_FORMAT = new ThreadLocal() {
        @Override
        protected DateTimeFormatter initialValue() {
            return DateTimeFormatter.ofPattern(DAY_FORMAT);
        }
    };

    public static ThreadLocal FMT_ISO_DATE_FORMAT = new ThreadLocal() {
        @Override
        protected DateTimeFormatter initialValue() {
            return DateTimeFormatter.ofPattern(ISO_DATE_FORMAT);
        }
    };

    public static ThreadLocal FMT_ISO_DATE_FORMAT_OFFSET = new ThreadLocal() {
        @Override
        protected DateTimeFormatter initialValue() {
            return DateTimeFormatter.ofPattern(ISO_DATE_FORMAT_OFFSET);
        }
    };

    public static ThreadLocal FMT_DATE_FORMAT_OUT = new ThreadLocal() {
        @Override
        protected DateTimeFormatter initialValue() {
            return DateTimeFormatter.ofPattern(DATE_FORMAT_OUT);
        }
    };

    public static ThreadLocal FMT_DATE_FORMAT_OUT_SEC = new ThreadLocal() {
        @Override
        protected DateTimeFormatter initialValue() {
            return DateTimeFormatter.ofPattern(DATE_FORMAT_OUT_SEC);
        }
    };
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy