Java Long Number to Time convertUnixTimeStampToMySql(long timestamp)

Here you can find the source of convertUnixTimeStampToMySql(long timestamp)

Description

convert Unix Time Stamp To My Sql

License

Open Source License

Declaration

public static String convertUnixTimeStampToMySql(long timestamp) 

Method Source Code


//package com.java2s;
//License from project: Open Source License 

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

public class Main {
    public static String convertUnixTimeStampToMySql(long timestamp) {
        Date date = new Date(timestamp * 1000L);
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        String formattedDate = "";

        try {/*  w w w.j a  v a2s. co  m*/
            formattedDate = sdf.format(date);
        } catch (Exception E) {
            E.printStackTrace();
        }

        return formattedDate;
    }
}

Related

  1. convertTimeToString(final long time)
  2. convertTimeToString(final long timeInMillis)
  3. convertTimeUnit(long epochTime, String timeUnit)
  4. convertTimeUnit(long epochTime, String timeUnit)
  5. convertUnixTime(long unixtime)
  6. createCookie(String name, String value, String path, String domain, long stateTimeToLive)
  7. createFileDateTimeString(final Long ms)
  8. elapsedTime(long start, long end)
  9. elapsedTimeToString(long elapsedTime)