项目后台用的php,由于php和java有些不一样,看下获取当前时间戳的写法php
java写法java
long timeStamp = System.currentTimeMillis(); //获取当前时间戳
php写法code
int seconds = System.currentTimeMillis() / 1000;
因此,后台拿到一个php的时间戳后orm
String time = "1462945980"; SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd"); String sd = sdf.format(new Date(Long.parseLong(String.valueOf(time+"000")))); // 时间戳转换成时间 System.out.println(sd);
结果form
2016-05-11
后台