Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

import java.text.SimpleDateFormat;
import java.util.Date;

public class Main {
    public static void main(String[] args) throws Exception {
        SimpleDateFormat sd = new SimpleDateFormat();
        String dateString = "2015-01-02 14:59:27.953";
        sd.applyPattern("yyyy-MM-dd HH:mm:ss.SSS");
        Date date = sd.parse(dateString);
        sd.applyPattern("MM/dd/yyyy HH:mm a");
        System.out.println(sd.format(date));
    }
}