Java Data Type How to - Format date as form of Jun 22, 2015 2:08 PM


We would like to know how to format date as form of Jun 22, 2015 2:08 PM.


import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.time.format.FormatStyle;
//w w  w .java  2s . c o m
public class Main {

  public static void main(String[] args) {
    DateTimeFormatter dateTimeFormatter = DateTimeFormatter
        .ofLocalizedDateTime(FormatStyle.MEDIUM, FormatStyle.SHORT);


The code above generates the following result.