Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

import java.text.ParseException;
import java.text.SimpleDateFormat;

import java.util.Locale;

public class Main {
    public static String getFormattedTime(String time) {
        SimpleDateFormat sdfDate = new SimpleDateFormat("dd-MM-yyyy HH:mm", Locale.ENGLISH);
        String strDate = null;
        try {
            strDate = String.valueOf(sdfDate.parse(time));
        } catch (ParseException e) {
            e.printStackTrace();
            strDate = "";
        }
        return strDate;
    }
}