Skip to content

Commit caa6060

Browse files
committed
date7__Calendar_get
1 parent 8f26eb6 commit caa6060

3 files changed

Lines changed: 34 additions & 2 deletions

File tree

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
* @由于个人水平有限, 难免有些错误, 还请指点:
33
* @Author: cpu_code
44
* @Date: 2020-07-12 12:03:11
5-
* @LastEditTime: 2020-09-15 21:50:10
5+
* @LastEditTime: 2020-09-16 09:02:03
66
* @FilePath: \java\README.md
77
* @Gitee: [https://gitee.com/cpu_code](https://gitee.com/cpu_code)
88
* @Github: [https://github.com/CPU-Code](https://github.com/CPU-Code)
@@ -221,6 +221,7 @@ java编程基础 面向对象 javaAPI 集合 IO GUI JD8C 多线程 网络编程
221221
- [x] [date4__parse方法](javaAPI/date/date4.java)
222222
- [x] [date5__birthdayString显示](javaAPI/date/date5.java)
223223
- [x] [date6__Calendar](javaAPI/date/date6.java)
224+
- [x] [date7__Calendar_get](javaAPI/date/date7.java)
224225

225226
-----------------------
226227

javaAPI/date/date6.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
* @由于个人水平有限, 难免有些错误, 还请指点:
33
* @Author: cpu_code
44
* @Date: 2020-09-15 21:50:28
5-
* @LastEditTime: 2020-09-15 21:52:01
5+
* @LastEditTime: 2020-09-15 21:55:27
66
* @FilePath: \java\javaAPI\date\date6.java
77
* @Gitee: [https://gitee.com/cpu_code](https://gitee.com/cpu_code)
88
* @Github: [https://github.com/CPU-Code](https://github.com/CPU-Code)
@@ -20,3 +20,7 @@ public static void main(String[] args) {
2020
System.out.println(cal.getTime());
2121
}
2222
}
23+
24+
/*
25+
Tue Sep 15 21:51:45 CST 2020
26+
*/

javaAPI/date/date7.java

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
/*
2+
* @由于个人水平有限, 难免有些错误, 还请指点:
3+
* @Author: cpu_code
4+
* @Date: 2020-09-16 09:01:05
5+
* @LastEditTime: 2020-09-16 09:01:22
6+
* @FilePath: \java\javaAPI\date\date7.java
7+
* @Gitee: [https://gitee.com/cpu_code](https://gitee.com/cpu_code)
8+
* @Github: [https://github.com/CPU-Code](https://github.com/CPU-Code)
9+
* @CSDN: [https://blog.csdn.net/qq_44226094](https://blog.csdn.net/qq_44226094)
10+
* @Gitbook: [https://923992029.gitbook.io/cpucode/](https://923992029.gitbook.io/cpucode/)
11+
*/
12+
package javaAPI.date;
13+
14+
import java.util.Calendar;
15+
16+
public class date7 {
17+
public static void main(String[] args) {
18+
Calendar cal = Calendar.getInstance();
19+
20+
int year = cal.get(Calendar.YEAR);
21+
int month = cal.get(Calendar.MARCH) + 1;
22+
23+
int dayOfMonth = cal.get(Calendar.DAY_OF_MONTH);
24+
25+
System.out.println(year + "年" + month + "月" + dayOfMonth + "日");
26+
}
27+
}

0 commit comments

Comments
 (0)