Java把长整型时间转成字符串日期

数据库里存放的是timestamp格式,前端取得后是这种:
1436255550710长整型时间截
转换成"2015-07-07"这种格式呢?

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


public class Test {
/**
* Java把长整型时间转成字符串日期
* @param args
* @throws IOException
*/
    public static void main(String[] args){
    Date date=new Date(1436255550710l);
    SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
    String str = format.format(date);
    System.out.println(str);
    }
    
}

  

 

posted on 2016-03-12 20:46  janehlp  阅读(3514)  评论(0编辑  收藏  举报