Linked Questions

35 votes
5 answers
139k views

I want to subtract n days from the current date in Java. How do I do that?
Senthil Kumar's user avatar
37 votes
6 answers
146k views

I am using DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'"); Date date = new Date(); String fromdate = dateFormat.format(date); to get the current date, how can I get the ...
Tanu Garg's user avatar
  • 3,077
11 votes
5 answers
28k views

Possible Duplicate: Anyone know a simple way using java calendar to subtract X days to a date? I need to minus 365 days in a given date (givenDate)- Calendar calendar = Calendar.getInstance(); ...
Milli's user avatar
  • 111
2 votes
5 answers
1k views

I know I can get the current date using new Date(), but I want to get a past date (12 weeks back). For example: today is Jan 3rd 2014, a 12 weeks old date would be Oct 11 2013. How to do that in java?...
user3155754's user avatar
5 votes
2 answers
20k views

Possible Duplicate: How to subtract X days from a date using Java calendar? This should be fairly simple to answer, but I want to know: if you, for example, added 50 seconds to a Calendar, and the ...
Theway2cool1's user avatar
3 votes
3 answers
2k views

Possible Duplicate: Anyone know a simple way using java calendar to subtract X days to a date? Hi , Could anybody please tell me how can we subtract 45 days from the current sysdate ?? Thanks
user avatar
-3 votes
3 answers
3k views

long epoch = System.currentTimeMillis() / 1000; String dateStr = new java.text.SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'.0Z'").format(new java.util.Date(epoch * 1000)); System.out.println(dateStr); Can ...
Sunset Bloom's user avatar
1 vote
3 answers
6k views

I have an EpochTime for Now and I want to get 30 days, 3 Months, and 1 Year back epoch time How to do that in java code. long todayEpochTime = System.currentTimeMillis()/1000; System.out.println(...
Veerendra's user avatar
0 votes
3 answers
2k views

I want to subtract days from date in java. But I dont want to use external libraries. I have referred some of questions from stackoverflow but they are suggesting to use external libraries. So I have ...
sdk's user avatar
  • 317
-2 votes
4 answers
1k views

Possible Duplicate: Anyone know a simple way using java calendar to subtract X days to a date? I d like to get a date string from newDate, and from days so the yesterday day looks like this: ...
lacas's user avatar
  • 14.1k
0 votes
2 answers
600 views

I'm storing time in my database by setting year, month, day, hour, and minute individually, and I would like to know the date difference between two datetimes. This is clumsy and cumbersome, and I ...
405 Freeway's user avatar
1 vote
1 answer
145 views

Is there a convenient way of subtracting different units of time using the Calendar class? I am making a timer that counts down for multiple hours and prints the time to the console in hours, minutes, ...
Captain_D1's user avatar
-1 votes
1 answer
136 views

I want to show the date as "current date-180" days. How can I show this? I am adding my code below. Now I can choose date from datepicker dialog only, can't prepopulate date in textview. Calendar ...
user8737536's user avatar
0 votes
3 answers
113 views

First off thank you for taking the time to scroll through this. I am basically a greenhorn when it comes to Java but I am working on a program that asks the user some basic info then sets a start ...
NixondisNRVA's user avatar
282 votes
18 answers
789k views

I want to add one day to a particular date. How can I do that? Date dt = new Date(); Now I want to add one day to this date.
user93796's user avatar

15 30 50 per page