直接贴代码,清晰易懂。喜欢点个赞
class Timestamp {
/**
* Timestamp to String
* @param Timestamp
* @return String
*/
fun transToString(time:Long):String{
return SimpleDateFormat("YY-MM-DD-hh-mm-ss").format(time)
}
/**
* String to Timestamp
* @param String
* @return Timestamp
*/
fun transToTimeStamp(date:String):Long{
return SimpleDateFormat("YY-MM-DD-hh-mm-ss").parse(date, ParsePosition(0)).time
}
}