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.Date;

public class Main {
    public static String formatTimestamp(String in) {
        SimpleDateFormat formater = new SimpleDateFormat("yyyy_MM_dd_hh_mm_ss");
        Date date = null;
        try {
            date = formater.parse(in);
        } catch (ParseException e) {
            return "";
        }
        SimpleDateFormat sdf = new SimpleDateFormat("dd.MM.yyyy HH:mm:ss");
        return sdf.format(date);
    }
}