Java UNIX时间转换

public static String toLocalTime(String unix) { Long timestamp = Long.parseLong(unix) * 1000; String date = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new java.util.Date(tmestamp)); return date; }http://www.huiyi8.com/jiaoben/ 网页特效代码 public static String toUnixTime(String local){ SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); String unix = ""; try { unix = df.parse(local).getTime() + ""; } catch (ParseException e) { e.printStackTrace(); } return unix; }

posted @ 2014-07-01 11:40  回车桌面  阅读(267)  评论(0编辑  收藏  举报