Description:

Formats the current date and time using custom formats that are specified using a template string. This can be used when the requirements for the date presentation do not match the “short” or “long” form.

For example, if the app requires only a month and a day or a month and a year, or needs to combine date and times with time zone information, this method allows the app to present only those date elements in a format that respects the user's preferences.