The Solution 1 by
Uma Shankar Patel is straight to the point. I only want to add that both
ddd
and
d
given in the format, print the date and year specified by the formatter
yyyy
, is generally not printed after the time.
So, one of the standard DateTime formats given here
Standard DateTime Format Strings[
^]
or one of the custom DateTime format strings given here
Custom Date and Time Format Strings[
^]
will be a better option.