Java 如何将 int(分钟)添加到 LocalDateTime.now()?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/30374796/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-11 09:31:01 来源:igfitidea点击:
How can I add an int (minutes) to LocalDateTime.now()?
提问by
I want to modify LocalDateTime.now()
by adding a certain amount of minutes to it. How do I do that?
我想LocalDateTime.now()
通过添加一定量的分钟来修改它。我怎么做?
采纳答案by Raghuveer
If you are using java 8 then you can still use the same syntax
如果您使用的是 java 8 那么您仍然可以使用相同的语法
LocalDateTime fiveMinutesLater = LocalDateTime.now().plusMinutes(5)