Win a copy of Practical SVG this week in the HTML/CSS/JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Calculate Yesterday's date

 
Naveen R R
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I want to calculate yesterday's date. Could anyone help me with this?
java.util.Date today = new java.util.Date();
java.text.SimpleDateFormat df = new java.text.SimpleDateFormat("MM/dd/yyyy");
java.util.Date yesterday = (today) - 1; //ERROR
v.addElement(df.format(yesterday));
Thanks,
Naveen
 
Yogen Vadnere
Ranch Hand
Posts: 58
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
To get yday use following...
new Date(System.currentTimeMillis() -(24*60*60*1000))
Hope this will help u...
 
No prison can hold Chairface Chippendale. And on a totally different topic ... my stuff:
the new thread boost feature brings a LOT of attention to your favorite threads
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!