0

Given Input. 13-JAN-1982 Output should be. 14-JAN-1982.

Solve this in java

11th Aug 2019, 7:07 AM
Rajnish Kumar Mishra
Rajnish Kumar Mishra - avatar
4 Respostas
+ 2
This can be achieved through manipulation. Convert a substring of the first two elements in the input to type Integer, increment that number by one and then this number will be automatically converted back to a String if you concatenate the rest of the input to it. There’s probably more elegant way to do it, but this works. String input = "13-JAN-1982"; String output = Integer.parseInt(input.substring(0,2))+1+input.substring(2); System.out.println(output);
11th Aug 2019, 7:45 AM
Jake
Jake - avatar
0
Thank you so much jake
11th Aug 2019, 8:03 AM
Rajnish Kumar Mishra
Rajnish Kumar Mishra - avatar