在Java中将日期字符串转换为纪元 [英] Convert Date String into Epoch in Java

查看:95
本文介绍了在Java中将日期字符串转换为纪元的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有一种方法可以将给定的Date字符串转换为Java中的Milliseconds(Epoch长格式)?示例:我要转换

public static final String date = "04/28/2016"; 

到毫秒(纪元).

解决方案

Date类的getTime()方法返回自此Date对象表示的1970年1月1日格林尼治标准时间00:00:00以来的毫秒数./p>

Is there a way to convert a given Date String into Milliseconds (Epoch Long format) in java? Example : I want to convert

public static final String date = "04/28/2016"; 

into milliseconds (epoch).

解决方案

The getTime() method of the Date class returns the number of milliseconds since January 1, 1970, 00:00:00 GMT represented by this Date object.

这篇关于在Java中将日期字符串转换为纪元的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆