Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
import java.sql.Timestamp;

import java.text.SimpleDateFormat;

import java.util.Date;

public class Main {
    public static String convertmstodate(long timeStamp) {
        String result;
        Timestamp timestamp = new Timestamp(timeStamp);
        Date date = new Date(timestamp.getTime());

        // S is the millisecond
        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm");
        result = simpleDateFormat.format(timestamp);
        // System.out.println(simpleDateFormat.format(timestamp));
        // System.out.println(simpleDateFormat.format(date));

        return result;
    }
}