Skip to content

Instantly share code, notes, and snippets.

@travisdachi
Last active August 13, 2016 10:17
Show Gist options
  • Save travisdachi/bf9c8333da87af27b82e3f5a927ab22d to your computer and use it in GitHub Desktop.
Save travisdachi/bf9c8333da87af27b82e3f5a927ab22d to your computer and use it in GitHub Desktop.
fun Date.formatFancy(): String {
val myFancyFormat = ...
val f = SimpleDateFormat(myFancyFormat)
return f.format(this)
}
// fun <receiverType>.<functionName>(): <returnType>
someDate.formatFancy() //call within Kotlin
MyExtnsionsKt.formatFancy(someDate); //call from Java
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment