将字符串时间戳转换为日期 [英] Converting string timestamp to date

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

问题描述

如何将Thu Jun 07 13:01:59 IST 2007转换为 java 中的日期格式的字符串时间戳? b $ b

How do i convert a string time-stamp like "Thu Jun 07 13:01:59 IST 2007" to date format in java?

推荐答案

String ds = "Thu Jun 07 13:01:59 IST 2007";
SimpleDateFormat f = new SimpleDateFormat("EEE MMM dd HH:mm:ss zzz yyyy");
Date d = f.parse(ds);

正如其他人所说,答案在文档中。

As others mentioned, the answer is in the docs.

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

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