当前位置:网站首页>joda.time获取日期总结
joda.time获取日期总结
2022-06-25 06:32:00 【飞翔的佩奇】
1、获取当前日期和昨天的日期 (格式yyyy-MM-dd)
@Test
public void testJodaTime(){
LocalDate localDate = new LocalDate();
System.out.println(localDate.toString());//获取当前日期 2022-06-23
LocalDate yesterday = localDate.plusDays(-1);// 往前推一天,得到昨天的日期
System.out.println(yesterday.toString());// 2022-06-22
}

2、获取具体年、月、日
@Test
public void testJodaTime(){
DateTime dateTime = new DateTime();
int day = dateTime.getDayOfMonth();
int month = dateTime.getMonthOfYear();
int year = dateTime.getYear();
System.out.println("今天是"+ day +"号");
System.out.println("现在是"+ month +"月");
System.out.println("现在是"+ year +"年");
}

边栏推荐
- Find command – find and search for files
- JS to determine whether an element exists in the array (four methods)
- Wan Yin revealed that he was rejected by MIT in this way: "the department doesn't like you". He confronted the principal and realized
- Laravel8+ wechat applet generates QR code
- Which of the top ten securities companies has the lowest Commission and is the most safe and reliable? Do you know anything
- [short time energy] short time energy of speech signal based on MATLAB [including Matlab source code 1719]
- A + B Again
- How to realize hierarchical management of application and hardware in embedded projects
- How to use asemi FET 7n80 and how to use 7n80
- How to deploy locally developed SAP ui5 applications to ABAP servers
猜你喜欢
![[speech discrimination] discrimination of speech signals based on MATLAB double threshold method [including Matlab source code 1720]](/img/36/ad86f403b47731670879f01299b416.jpg)
[speech discrimination] discrimination of speech signals based on MATLAB double threshold method [including Matlab source code 1720]

sin(a+b)=sina*cosb+sinb*cosa的推导过程

How to deploy locally developed SAP ui5 applications to ABAP servers

DataX tutorial (09) - how does dataX achieve speed limit?
![[Suanli network] technological innovation of Suanli Network -- Key Technologies of green and security](/img/52/7dedc5b6e213839fbf5cee3963ac99.jpg)
[Suanli network] technological innovation of Suanli Network -- Key Technologies of green and security

Monitoring access: how to grant minimum WMI access to the monitoring service account

From file system to distributed file system
![[kicad image] download and installation](/img/88/cebf8cc55cb8904c91f9096312859a.jpg)
[kicad image] download and installation

What is cloud primordial?
![[Suanli network] problems and challenges faced by the development of Suanli network](/img/90/1d537de057113e2b4754e76746f256.jpg)
[Suanli network] problems and challenges faced by the development of Suanli network
随机推荐
ctfshow-misc
Mount command - file system mount
Highway
Methods for obtaining some information of equipment
Analysis report on demand scale and Supply Prospect of global and Chinese thermal insulation materials market during the 14th Five Year Plan period 2022-2028
[Suanli network] technological innovation of Suanli Network -- Key Technologies of green and security
Which of the top ten securities companies has the lowest Commission and is the most safe and reliable? Do you know anything
General test point ideas are summarized and shared, which can be directly used in interview and actual software testing
JSON. toJSONString(object, SerializerFeature.WriteMapNullValue); Second parameter action
Observation configuring wmic
Global and Chinese medical protective clothing market supply and demand research and investment value proposal report 2022-2028
SAP QM executes the transaction code qp01, and the system reports an error -material type food is not defined for task list type Q-
Research Report on brand strategic management and marketing trends in the global and Chinese preserved fruit market 2022
Handling skills of SQL optimization (2)
Microsoft issued a document to celebrate Net 20th anniversary!
Report on strategic suggestions on investment direction and Prospect of global and Chinese marine biological industry (2022 Edition)
[speech discrimination] discrimination of speech signals based on MATLAB double threshold method [including Matlab source code 1720]
JS dynamic table creation
Sleep quality today 67 points
2022 AI trend 8 forecast!