[Solved] Why do i need DateFormat? [closed]


If you output the Date object directly, its toString function is called implicitly, giving you a string in the format dow mon dd hh:mm:ss zzz yyyy, which may or may not be what you want.

Using DateFormat implementation lets you choose the date format that seems appropriate for your task. The method used in that code, getDateInstance, gives you a formatter that uses a format based on the current locale. There are lots of other ways you can get DateFormat instances, depending on what you want to do, but that one is a reasonable general-purpose formatter for dates in the current locale.

0

solved Why do i need DateFormat? [closed]