时间转换
Timestamp tst = new Timestamp(System.currentTimeMillis());
try {
tst = new Timestamp(format1.parse(newTime).getTime());
} catch (ParseException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
本文介绍了如何使用Java进行时间戳的转换。包括通过System.currentTimeMillis()获取当前时间的时间戳,以及通过特定格式的字符串转换为时间戳的方法。文章提供了具体的代码示例,并展示了如何处理可能发生的ParseException异常。
时间转换
Timestamp tst = new Timestamp(System.currentTimeMillis());
try {
tst = new Timestamp(format1.parse(newTime).getTime());
} catch (ParseException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
1万+
1万+
1907
1193
3030
1万+

被折叠的 条评论
为什么被折叠?
