如何字符串转换为日期对象? [英] How to convert string to date object?

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

问题描述

String date="2006-06-21T15:57:24.000Z";

我如何把这个字符串转换为日期对象在不改变Android的这种格式?

How do I convert this String to a Date object without changing this format in Android?

推荐答案

使用Time类和解析字符串。然后使用时间toMillis()函数实例化一个日期。

Use the Time class and parse the string. Then use the Time toMillis() function and instantiate a Date.

<一个href=\"http://developer.android.com/reference/android/text/format/Time.html#parse3339(java.lang.String\" rel=\"nofollow\">http://developer.android.com/reference/android/text/format/Time.html#parse3339(java.lang.String)

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

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