I have a string
String time = "2012-09-12 15:04:01";
I want to parse that string to Joda-Time:
DateTimeFormatter dateStringFormat = DateTimeFormat.forPattern("yyyy-MM-dd HH:mm:ss");
DateTime time = dateStringFormat.parseDateTime(date);
But when I print time
time.toString()
The output is:
2012-09-12T15:04:01.000+03:00
Why output is different from input? What I do wrong? I mean what is ‘T’?? Thanks in advance.
When you parse a date or number you extra its value, not the format it was as a String.
When you toString() the value is converts it to a default format.
It would be surprising coincidence if it were the same.
Assuming there is only one format of a value.
It means it is in ISO 8601 format.
BTW you have the same problem with numbers
prints
In each case the value is correct, but original format is not recorded or preserved.