Java DateTimeFormatter setDateFormat(String pattern)

Here you can find the source of setDateFormat(String pattern)

Description

set Date Format

License

LGPL

Declaration

public static void setDateFormat(String pattern) 

Method Source Code

//package com.java2s;
/*/*w  w  w  . j  ava2  s. c o m*/
 * License GNU LGPL
 * Copyright (C) 2012 Amrullah <amrullah@panemu.com>.
 */

import java.text.DateFormat;

import java.text.SimpleDateFormat;

import java.time.format.DateTimeFormatter;

public class Main {
    private static DateTimeFormatter dateTimeFormatter;
    private static DateFormat dateFormat;

    public static void setDateFormat(String pattern) {
        dateTimeFormatter = DateTimeFormatter.ofPattern(pattern);
        dateFormat = new SimpleDateFormat(pattern);
    }
}

Related

  1. parse(String _date, String _format)
  2. parse(String format, String datetime)
  3. parseAndFormat(String date, DateTimeFormatter fromFormatter, DateTimeFormatter toFormatter)
  4. parseDateTime(String dateTimeStr, String format)
  5. parseZoneDateTime(String value, DateTimeFormatter formatter)
  6. validateDate(String input, DateTimeFormatter formatter)