Java DateTimeFormatter create14DigitDateTimeFormat()

Here you can find the source of create14DigitDateTimeFormat()

Description

create Digit Date Time Format

License

Open Source License

Declaration

public static DateTimeFormatter create14DigitDateTimeFormat() 

Method Source Code


//package com.java2s;
/*/*  ww  w. j  av a 2 s  .c  om*/
 * Copyright 2014-2017, Andrew Lindesay
 * Distributed under the terms of the MIT License.
 */

import java.time.ZoneOffset;
import java.time.format.DateTimeFormatter;
import java.time.format.DateTimeFormatterBuilder;

import java.util.Locale;
import static java.time.temporal.ChronoField.*;

public class Main {
    public static DateTimeFormatter create14DigitDateTimeFormat() {
        return new DateTimeFormatterBuilder().appendValue(YEAR, 4).appendValue(MONTH_OF_YEAR, 2)
                .appendValue(DAY_OF_MONTH, 2).appendValue(HOUR_OF_DAY, 2).appendValue(MINUTE_OF_HOUR, 2)
                .appendValue(SECOND_OF_MINUTE, 2).toFormatter(Locale.ENGLISH).withZone(ZoneOffset.UTC);
    }
}

Related

  1. convertToEpochMillis(String logTimestamp, DateTimeFormatter logTimeFormat)
  2. createFormatterFromPatternString(String formatPattern, Locale locale)
  3. dateTimeFormatterNCForPattern(String pattern)
  4. format(DateTimeFormatter formatter, Object object)
  5. format(long epochMilliSecond)