Android 中的日期格式
我陷入了一种日期格式,
我希望我的日期应该是这样的,2011 年 3 月 18 日 它可以是第一、第二、第三,这意味着我想解决所有方面,
请尽快帮助我解决这个问题,
提前感谢所有人。
I am stuck in one date format
i want my date should look like this, 18th Mar 2011
and it can be 1st, 2nd,3rd that means i want to resolve for all the aspects
Plz help me out for this ASAP
Thanks in advance to all.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我想你想以第 18、2、1、3 种日期方式更改日期,如果我没记错的话,你可以使用 simpleDateFormat 类来转换不同格式的日期。
在使用SimpleDateFormat之前,只需参考SDK文档: http://developer.android.com /reference/java/text/SimpleDateFormat.html。
要使用 nd、th、rd(即第 2、4、3 等),您可以使用:
F - 一个月中的星期几(数字)- 2(7 月的第 2 个星期三)
(在文档中给出)。
例如使用 SimpleDateFormat:
I think you want to change date in a 18th, 2nd, 1st, 3rd dated way, if i am not wrong then you can use simpleDateFormat class to convert date in different formats.
Before using SimpleDateFormat, just refer the SDK documentation: http://developer.android.com/reference/java/text/SimpleDateFormat.html.
To have day number with nd, th, rd (i.e. 2nd, 4th, 3rd, etc.), you can use:
F - day of week in month (Number) - 2 (2nd Wed in July)
(given in the documentation).
For example using SimpleDateFormat:
这是您正在寻找的术语:数量字符串(复数)
这里是文档中的链接:
复数
以下是示例链接:
示例
还有一个:
Android 复数无法正常工作,需要帮助
希望这会有所帮助。因此,您只需使用提供的示例重新格式化带有日期的字符串即可。
This is the term you are looking for: Quantity Strings (Plurals)
here is a link for it in the documentation:
Plurals
Here is a link with examples:
Examples
And One more:
Android Pluralization not working, need help
Hope this helps. so you just need to reformat the string with the date by using the examples provided and thats it.