8
7

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Javaで1日後・1日前みたいなのを計算する方法

Last updated at Posted at 2016-05-13

1日後

Calendar cal = Calendar.getInstance();
cal.add(Calendar.DATE, 1);

1日前

Calendar cal = Calendar.getInstance();
cal.add(Calendar.DATE, -1);

1ヶ月後

Calendar cal = Calendar.getInstance();
cal.add(Calendar.MONTH, 1);

1年進める

Calendar cal = Calendar.getInstance();
cal.add(Calendar.YEAR, 1);
8
7
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
8
7

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?