Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
    Bookmark Topic Watch Topic
  • New Topic

Date

 
vidhya subramaniam
Ranch Hand
Posts: 91
  • Mark post as helpful
  • send pies
  • Report post to moderator
How do I get today's date in java?
I am actually using javamail to read messages. So i want to pick those messages from yest aftder 2 pm to today. How can I do that?
Thanks,
Vidhya
 
Cindy Glass
"The Hood"
Sheriff
Posts: 8521
  • Mark post as helpful
  • send pies
  • Report post to moderator
Date rightNow = new Date(); // Allocates a Date object and initializes it so that it represents the time at which it was allocated, measured to the nearest millisecond.
or:
Calendar rightNow = Calendar.getInstance();
 
Jim Yingst
Wanderer
Sheriff
Posts: 18671
  • Mark post as helpful
  • send pies
  • Report post to moderator
Let's try to keep the discussion for this one in one place. I'm closing this thread; follwups can go here. Thanks.
 
    Bookmark Topic Watch Topic
  • New Topic