Skip to content

Commit

Permalink
Add toDayCode extension function
Browse files Browse the repository at this point in the history
  • Loading branch information
naveensingh committed May 1, 2024
1 parent 88a349f commit 5bf58fd
Showing 1 changed file with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,9 @@ fun Long.formatDate(context: Context, dateFormat: String? = null, timeFormat: St
cal.timeInMillis = this
return DateFormat.format("$useDateFormat, $useTimeFormat", cal).toString()
}

fun Long.toDayCode(format: String = "ddMMyy"): String {
val cal = Calendar.getInstance(Locale.ENGLISH)
cal.timeInMillis = this
return DateFormat.format(format, cal).toString()
}

0 comments on commit 5bf58fd

Please sign in to comment.