当前位置:网站首页>Gets all dates between two times
Gets all dates between two times
2022-04-23 04:43:00 【Mount MONI】
Two hours :start="2019 year 11 month 13 Japan " end="2019 year 12 month 05 Japan "
/***
* <p>Title: getBetweenDates2</p>
* <p>Description: Gets all dates between two times </p>
* @param start
* @param end
* @return
*/
public static List<String> getBetweenDates2(String start, String end) {
List<String> result = new ArrayList<String>();
try {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy year MM month dd Japan ");
Date start_date = sdf.parse(start);
Date end_date = sdf.parse(end);
Calendar tempStart = Calendar.getInstance();
tempStart.setTime(start_date);
Calendar tempEnd = Calendar.getInstance();
tempEnd.setTime(end_date);
while (tempStart.before(tempEnd) || tempStart.equals(tempEnd)) {
result.add(sdf.format(tempStart.getTime()));
tempStart.add(Calendar.DAY_OF_YEAR, 1);
}
} catch (ParseException e) {
e.printStackTrace();
}
//Collections.reverse(result);
return result;
}
The test method
public static void main(String[] args) throws IOException, ParseException {
List<String> betweenDates = getBetweenDates2("2019 year 11 month 13 Japan ","2019 year 12 month 05 Japan ");
System.out.println(JSONObject.toJSONString(betweenDates));
}
版权声明
本文为[Mount MONI]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204220558291840.html
边栏推荐
- test
- Phishing for NFT
- 第四章 --- 了解标准设备文件、过滤器和管道
- Basic operation of sequence table
- Kotlin. The binary version of its metadata is 1.6.0, expected version is 1.1.15.
- What's the difference between error and exception
- Brushless motor drive scheme based on Infineon MCU GTM module
- How to regulate intestinal flora? Introduction to common natural substances, probiotics and prebiotics
- Chapter 4 - understanding standard equipment documents, filters and pipelines
- Unity攝像頭跟隨鼠標旋轉
猜你喜欢

Go reflection rule

補:注解(Annotation)

229. 求众数 II

Recommended scheme of national manufactured electronic components for intelligent electronic scales

Installation and deployment of Flink and wordcount test

Interaction of diet gut microbiota on cardiovascular disease

/etc/bash_ completion. D directory function (the user logs in and executes the script under the directory immediately)

The perfect combination of collaborative process and multi process

Shanghai Hangxin technology sharing 𞓜 overview of safety characteristics of acm32 MCU

Ali's ten-year technical experts jointly created the "latest" jetpack compose project combat drill (with demo)
随机推荐
/etc/bash_ completion. D directory function (the user logs in and executes the script under the directory immediately)
The programmer starts the required application with one click of window bat
Migrate from MySQL database to AWS dynamodb
Interaction of diet gut microbiota on cardiovascular disease
io. Platform. packageRoot; // ignore: deprecated_ Member_ use
2021数学建模国赛一等奖经验总结与分享
Apache Bench(ab 压力测试工具)的安装与使用
test
leetcode001--返回和为target的数组元素的下标
Microbial neuroimmune axis -- the hope of prevention and treatment of cardiovascular diseases
IEEE Transactions on systems, man, and Cybernetics: Notes for systems (TSMC)
520. Detect capital letters
補:注解(Annotation)
What's the difference between error and exception
win10, mysql-8.0.26-winx64. Zip installation
Redis 命令大全
383. 赎金信
Eight misunderstandings that should be avoided in data visualization
C language: spoof games
Leetcode004 -- Roman numeral to integer