1.方法体中的

package org.joda.time.DateTime(long类型)
fun Long?.toDateTime() = if (null != this) DateTime(this) else null

2.再一个方法

private fun dateTime(
            time:Long? = null
    ) = if(time != null) time?.toDateTime().toString() else ""

3.直接调用 上面的方法即可实现转化

dateTime(Long?类型的字段)

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-02-08
  • 2021-11-24
  • 2021-10-12
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-02-08
  • 2022-02-25
  • 2022-02-24
  • 2021-12-09
  • 2022-02-08
相关资源
相似解决方案