format ZonedDateTime as ddMMYYYYHHmmss - Java java.time

Java examples for java.time:ZonedDateTime

Description

format ZonedDateTime as ddMMYYYYHHmmss

Demo Code


//package com.java2s;

import java.time.ZonedDateTime;
import java.time.format.DateTimeFormatter;

public class Main {
    /**//  w w w.j a  v a  2s. c o  m
     * @param when The instant
     * @return The instant formatted as "ddMMYYYYHHmmss" (01092015121011)
     */
    static DateTimeFormatter dateTimeFormatPattern = DateTimeFormatter
            .ofPattern("ddMMyyyyHHmmss");

    public static String formatDate_ddMMYYYYHHmmss(ZonedDateTime now) {
        return now.format(dateTimeFormatPattern);
    }
}

Related Tutorials