CopyPastor

Detecting plagiarism made easy.

Score: 0.8906801609804863; Reported for: String similarity Open both answers

Possible Plagiarism

Plagiarized on 2012-10-27
by Ram kiran Pachigolla

Original Post

Original - Posted on 2011-11-07
by Guillaume



            
Present in both answers; Present only in the new answer; Present only in the old answer;

The Date class has no "internal" format, it only represents date elements. To output it using a specific format, you need to do the way you did: String tDate = formatter1.format(date);
The reason why you think it has the "wrong format" is probably because when you try to output it, it does a toString() by default, which doesn't format it the way you want.
If you give us more details about how you want to use that date (include your code), then we might be able to provide suggestions on how to inject the formatter into it.
Date does not store any format info itself. =
The Date class has no "internal" format, it only represents date elements. To output it using a specific format, you need to do the way you did: <code>String tDate = formatter1.format(date);</code>
The reason why you think it has the "wrong format" is probably because when you try to output it, it does a <code>toString()</code> by default, which doesn't format it the way you want.
If you give us more details about how you want to use that date (include your code), then we might be able to provide suggestions on how to inject the formatter into it.

        
Present in both answers; Present only in the new answer; Present only in the old answer;