• Post Reply Bookmark Topic Watch Topic
  • New Topic

plz give me an idea...  RSS feed

 
Jack Daniel
Ranch Hand
Posts: 163
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi e'body ;-)
Well, I am presently working on a Time-Tracking j2ee application..
and now I need a way to some-how find the date of the most recent SUNDAY on calendar...
Is there a way to do this..
your help would be greatly appreciated...
I will also try to dig in more and see if i can solve this...
Thanks...
waiting for your help :-)
 
Chris Shepherd
Ranch Hand
Posts: 286
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well a real dirty way to do it that springs to mind is to take the current date and get the string output that includes its day tag(mon,tues,wed...) Search for each of those strings and when you find it, you know the current day.(I think you could format the output to only show you the day) Once you know what today is, you can calculate how many seconds(or miliseconds, I forget which the long value uses) you need to subtract from the long value to place the date on the previous sunday.
TADA!!..
Hope this helps...
Chris
 
Joel McNary
Bartender
Posts: 1840
Eclipse IDE Java Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Use java.util.Calendar:
 
Jack Daniel
Ranch Hand
Posts: 163
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear Joel,
Your help was just Great ;-)
Thanks a lot,...
PS: javaRanch is GREAT!!!
 
Marilyn de Queiroz
Sheriff
Posts: 9082
12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by prashant K:


Hi, Prashant K

Please adjust your display name to meet the JavaRanch Naming Policy which requires a first name and a last name. A last initial ('K') is not sufficient to meet the requirements.

You can change it here.

Thanks!
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!