使用Android格式化字符串时间戳 [英] Formatting a string timestamp with Android
本文介绍了使用Android格式化字符串时间戳的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
由于某种原因,这使我把头发扯了.
For some reason this has me tearing my hair out.
我有一个UNIX时间戳作为Android中的字符串.我要做的就是格式化此格式,以便它返回用户droid时区中的日期/时间.
I have a UNIX timestamp as a string in Android. All I want to do is format this so that it returns the date/time in the user's droid time zone.
我可以将其转换为时间戳,但是它使用GMT而不是其本地区域.
I can convert it to a timestamp just fine, but it uses GMT rather than their localised zone.
谢谢
推荐答案
将 SimpleDateFormat
构造函数与所需的 Locale
一起使用:
Use the SimpleDateFormat
constructor with the Locale
you need:
查看全文