Java Hour Format format(long time)

Here you can find the source of format(long time)

Description

format

License

Open Source License

Declaration

public static String format(long time) 

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 format(Date date) {
        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        return simpleDateFormat.format(date);
    }/*  ww w  . jav  a2  s.c o  m*/

    public static String format(long time) {
        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        return simpleDateFormat.format(new Date(time));
    }
}

Related

  1. format(final Date date)
  2. format(int level, String message, String source, boolean verbose)
  3. format(java.util.Date date, String format)
  4. format(List list, int scale)
  5. format(long time)
  6. format(Number price)
  7. format(String format, Date val)
  8. format(String pattern)
  9. format(String str)