I am trying to create an extension function on java.lang.System to refactor currentTimeMillis usage to the following System.currentTimeinSeconds() extension method that returns a String. (This is done to avoid duplicate code and to reuse it in the code)
This is what I have tried but its not working:
fun System.currentTimeInSeconds () : String {
return ((this.currentTimeMillis / 1000).toString())
Any guidance as to why this is not working? Thanks.

You cannot do this. Kotlin currently only supports extension functions on objects, not classes, and System is a class.