Skip to content

Instantly share code, notes, and snippets.

View tejas-ardeshna's full-sized avatar

Tejas Ardeshna tejas-ardeshna

View GitHub Profile
/**
* get the date format by using the date as a string.
* This Extension function returns date format, if it matches with any format else it will return null
*/
fun String.getDateFormat(): String? {
val dateFormats = arrayOf(
"yyyy-MM-dd'T'HH:mm:ss.SSSXXX",
"yyyy-MM-dd'T'HH:mm:ss.SSS'Z'",
"yyyy-MM-dd'T'HH:mm:ss.SSSZ",
"yyyy-MM-dd'T'HH:mm:ss'Z'",