to String

fun Date.toString(toFormat: String, locale: Locale = Locale.getDefault()): String?

Extension method from date to format Date to String

Return

String if formatting success and null if there's exception

Parameters

toFormat

format String to be formatted

locale

the locale of the result string, default value = Locale.getDefault()

Sources

Link copied to clipboard