22 lines
550 B
Kotlin
22 lines
550 B
Kotlin
package com.gh.common.util
|
|
|
|
import java.text.SimpleDateFormat
|
|
import java.util.*
|
|
|
|
object TimeUtils {
|
|
|
|
/**
|
|
* 获取今天日期
|
|
*/
|
|
@JvmStatic
|
|
fun getToday(): String {
|
|
var date = Date()
|
|
val calendar = GregorianCalendar()
|
|
calendar.time = date
|
|
//把日期往后增加一天.整数往后推,负数往前移动
|
|
calendar.add(GregorianCalendar.DATE, 0)
|
|
date = calendar.time
|
|
val formatter = SimpleDateFormat("yyyy-MM-dd", Locale.CHINA)
|
|
return formatter.format(date)
|
|
}
|
|
} |