时间戳转换为时间:
/* * 将时间戳转换为时间 */ public static string stamptodate(string s){ string res; simpledateformat simpledateformat = new simpledateformat("yyyy-mm-dd hh:mm:ss"); long lt = new long(s); date date = new date(lt); res = simpledateformat.format(date); return res; }
时间转换为时间戳:
/* * 将时间转换为时间戳 */ public static string datetostamp(string s) throws parseexception{ string res; simpledateformat simpledateformat = new simpledateformat("yyyy-mm-dd hh:mm:ss"); date date = simpledateformat.parse(s); long ts = date.gettime(); res = string.valueof(ts); return res; }
转载:
如对本文有疑问, 点击进行留言回复!!
android sdk源码 andoid-21 下的TextUtils.java文本工具类 源码赏析
地理坐标(WGS84),投影坐标下(Mercator)切片系统的计算Java类
荐 JavaWeb~简单认识以太网、MAC地址、MTU机制、ARP协议、DNS协议
HUAWEI MH5000-31 LGA Module Hardware Guide draft
网友评论