jeudi 2 juillet 2015

How to store and display customized date format?

I'm currently building an android app for notes. What I want is to able to save and display the date at which the note was created or saved.

Right now I'm doing it with an SQLite Database. I just created a row and stored the current date in a custom format with SimpleDateFormat. I can easily save and display it.

What I want is, that if the note is created today and we see it in our ListView in the MainActivity the date should say "Today, HH:mm" instead of the full day. Same for "Yesterday, HH:mm". Maybe Id also like if it would say "Monday, HH:mm" if were still just some days away from the date the note was created or saved.

I think I could get it to work with many if-Statements, but it would be really much work and I don't know if it would be that efficient.

Is there an easier way to do it?

Thanks in advance.

Aucun commentaire:

Enregistrer un commentaire