• Post Reply Bookmark Topic Watch Topic
  • New Topic

Counting number of weeks using timestamp  RSS feed

 
jess tan
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I need to retrieve datetime from database in this format: 2010-08-28 06:24:22.0
place it in arraylist (timestamp), and sort the arraylist according to weeks from today's date.

I am not sure how to go about arranging the dates and sort according to weeks.

Can someone please guide me on where and how should i go about doing it? thanks
 
Wouter Oet
Bartender
Posts: 2700
IntelliJ IDE Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What have you tried so far? Try looking for existing classes that you might need. Remember that learning to program is to try, experiment, fail and learn.
 
jess tan
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have tried to convert timestamp to long then from there manually state that if (today date - the database date) is < 8, its week 1 , if is >7 <15 , its week 2.

Was wondering if there is a better way to go about it.
 
Wouter Oet
Bartender
Posts: 2700
IntelliJ IDE Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Look at java.util.Date and java.util.Calendar.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!