When you parse a date or number, you add its value, not the format that it was like a string.
When you toString (), the value converts it to the default format.
Why is the output different from the input?
It would be an amazing coincidence if it were the same.
What am I doing wrong?
Assuming that there is only one value format.
I mean, what is a 'T'?
This means that it is in ISO 8601 format .
By the way, you have the same problem with numbers
System.out.println(Double.parseDouble("123456789")); System.out.println(Double.parseDouble("1.1e2"));
prints
1.23456789E8 110.0
In each case, this value is true, but the original format is not recorded or saved.
source share