The title is quite self explanatory.
I realize this might seem trivial and already answered but it is not.
All the answers I found either:
Ask for a format to be specified/hardcoded as "yyyyMMdd HH:mm" (e.g. this answer)
Or they return both date and time (e.g. this).
I need just the time returned from a existing
Date object as a string in the user's current locale.
I might be missing something here, but wouldn't the following work?
final DateFormat f = DateFormat.getTimeInstance(); f.format(new Date()));
This outputs e.g.:
Similarly, if you wish to extract only the date, use