+ 8
Get Dates
Hi! I don't have code to show yet. But what i want is: to pick date in format "dd-MM-yyyy HH:mm " for example i pick 12.10.2018 10:40 and i want to see the next date after x hours (for example the date after 48h so it will be 14.10.2018 10:40) how can i do it?
5 Respostas
+ 21
Maybe this helps you:
https://code.sololearn.com/ct9yJK82QPAf/?ref=app
+ 20
One way:
import java.time.LocalDateTime;
import java.time.Period;
public class Program {
public static void main(String[] args){
LocalDateTime date =
LocalDateTime.of(
2018, 12, 19, 14, 38, 00);
System.out.print(
date.plus(Period.ofDays(2)));
}
}
Works with hours as well:
import java.time.Duration;
...
date.plus(Duration.ofHours(48)));
+ 7
Check the following code :
https://code.sololearn.com/c6VKfiKw1Nfe/#java
What do you mean pick a date ?
as an input string ?
+ 5
Thanks Will check all of those you send me :)
0
Hello