Linked Questions
27 questions linked to/from How to subtract X days from a date using Java calendar?
35 votes
5 answers
139k views
How to subtract n days from current date in java? [duplicate]
I want to subtract n days from the current date in Java. How do I do that?
37 votes
6 answers
146k views
How to get the date 7 days earlier date from current date in Java [duplicate]
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 ...
11 votes
5 answers
28k views
Subtracting days in a Calendar object [duplicate]
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(); ...
2 votes
5 answers
1k views
How to calculate 12 weeks back date in java? [duplicate]
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?...
5 votes
2 answers
20k views
Adding time to calendar [duplicate]
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 ...
3 votes
3 answers
2k views
How to subtract 45 days from from the current sysdate [duplicate]
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
-3 votes
3 answers
3k views
Subtract four weeks from current time stamp [duplicate]
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 ...
1 vote
3 answers
6k views
How to Subtract 30Days, 3 Months & 1 Year In Epoch time from now using java? [duplicate]
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(...
0 votes
3 answers
2k views
Unable subtract days from date in java [duplicate]
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 ...
-2 votes
4 answers
1k views
Java getDate date-x days [duplicate]
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: ...
0 votes
2 answers
600 views
How would I subtract milliseconds from long year, long month, long day, long hour, and long minute? [duplicate]
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 ...
1 vote
1 answer
145 views
How do you subtract different units of time using Calendar [duplicate]
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, ...
-1 votes
1 answer
136 views
Prepopulated Date Using calender in android [duplicate]
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 ...
0 votes
3 answers
113 views
getting and setting dates with Java [duplicate]
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 ...
282 votes
18 answers
789k views
How to add one day to a date? [duplicate]
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.