java-转换时间日期格式字串为long型

来源:互联网 发布:fgo淘宝石头号怎么用 编辑:程序博客网 时间:2024/05/14 13:03
/** * 转换时间日期格式字串为long型  * @param time 格式为:yyyy-MM-dd HH:mm:ss的时间日期类型 */public static Long convertTimeToLong(String time) {Date date = null;try {SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");date = sdf.parse(time);return date.getTime();} catch (Exception e) {e.printStackTrace();return 0L;}}

0 0
原创粉丝点击