Android imitation wechat chat time format display function

This article shares Android's imitation wechat chat time format display function.

Display rules in the same year:

If it is the same day, the display format is HH: mm, for example: 14:45

If it is yesterday, the display format is yesterday HH: mm, for example, yesterday 13:12

If it is in the same week, the display format is Monday HH: mm, for example: Monday 14:05

If it is not the same week, the display format is the morning of M month D or other HH: mm, for example: 10:10 a.m. of February 5

Display rules not in the same year:

The display format is the evening of M / D, yyyy or other HH: mm, for example: 18:05 PM, February 5, 2016

If there is any error in the code, please leave a message.

The code implementation is as follows:

The above is the Android imitation wechat chat time format display function introduced by Xiaobian. I hope it will help you. If you have any questions, please leave me a message, and Xiaobian will reply to you in time. Thank you very much for your support for the programming tips website!

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>