TimeUtils

class TimeUtils

Functions

date2Millis
Link copied to clipboard
open fun date2Millis(date: Date): Long
Date to the milliseconds.
date2String
Link copied to clipboard
open fun date2String(date: Date): String
Date to the formatted time string.
open fun date2String(date: Date, format: DateFormat): String
Date to the formatted time string.
getChineseWeek
Link copied to clipboard
open fun getChineseWeek(time: String): String
Return the day of week in Chinese.
open fun getChineseWeek(date: Date): String
Return the day of week in Chinese.
open fun getChineseWeek(millis: Long): String
Return the day of week in Chinese.
open fun getChineseWeek(time: String, format: DateFormat): String
Return the day of week in Chinese.
getChineseZodiac
Link copied to clipboard
open fun getChineseZodiac(year: Int): String
Return the Chinese zodiac.
open fun getChineseZodiac(time: String): String
Return the Chinese zodiac.
open fun getChineseZodiac(date: Date): String
Return the Chinese zodiac.
open fun getChineseZodiac(millis: Long): String
Return the Chinese zodiac.
open fun getChineseZodiac(time: String, format: DateFormat): String
Return the Chinese zodiac.
getDate
Link copied to clipboard
open fun getDate(time: String, timeSpan: Long, unit: Int): Date
Return the date differ time span.
open fun getDate(date: Date, timeSpan: Long, unit: Int): Date
Return the date differ time span.
open fun getDate(millis: Long, timeSpan: Long, unit: Int): Date
Return the date differ time span.
open fun getDate(time: String, format: DateFormat, timeSpan: Long, unit: Int): Date
Return the date differ time span.
getDateByNow
Link copied to clipboard
open fun getDateByNow(timeSpan: Long, unit: Int): Date
Return the date differ time span by now.
getFitTimeSpan
Link copied to clipboard
open fun getFitTimeSpan(time1: String, time2: String, precision: Int): String
Return the fit time span.
open fun getFitTimeSpan(date1: Date, date2: Date, precision: Int): String
Return the fit time span.
open fun getFitTimeSpan(millis1: Long, millis2: Long, precision: Int): String
Return the fit time span.
open fun getFitTimeSpan(time1: String, time2: String, format: DateFormat, precision: Int): String
Return the fit time span.
getFitTimeSpanByNow
Link copied to clipboard
open fun getFitTimeSpanByNow(time: String, precision: Int): String
Return the fit time span by now.
open fun getFitTimeSpanByNow(date: Date, precision: Int): String
Return the fit time span by now.
open fun getFitTimeSpanByNow(millis: Long, precision: Int): String
Return the fit time span by now.
open fun getFitTimeSpanByNow(time: String, format: DateFormat, precision: Int): String
Return the fit time span by now.
getFriendlyTimeSpanByNow
Link copied to clipboard
open fun getFriendlyTimeSpanByNow(time: String): String
Return the friendly time span by now.
open fun getFriendlyTimeSpanByNow(date: Date): String
Return the friendly time span by now.
open fun getFriendlyTimeSpanByNow(millis: Long): String
Return the friendly time span by now.
open fun getFriendlyTimeSpanByNow(time: String, format: DateFormat): String
Return the friendly time span by now.
getHourLong
Link copied to clipboard
open fun getHourLong(user_time: String): Long
getHourNumber
Link copied to clipboard
open fun getHourNumber(time: Long): Long
毫秒值转换小时
getMillis
Link copied to clipboard
open fun getMillis(time: String, timeSpan: Long, unit: Int): Long
Return the milliseconds differ time span.
open fun getMillis(date: Date, timeSpan: Long, unit: Int): Long
Return the milliseconds differ time span.
open fun getMillis(millis: Long, timeSpan: Long, unit: Int): Long
Return the milliseconds differ time span.
open fun getMillis(time: String, format: DateFormat, timeSpan: Long, unit: Int): Long
Return the milliseconds differ time span.
getMillisByNow
Link copied to clipboard
open fun getMillisByNow(timeSpan: Long, unit: Int): Long
Return the milliseconds differ time span by now.
getNowDate
Link copied to clipboard
open fun getNowDate(): Date
Return the current date.
getNowMills
Link copied to clipboard
open fun getNowMills(): Long
Return the current time in milliseconds.
getNowString
Link copied to clipboard
open fun getNowString(): String
Return the current formatted time string.
open fun getNowString(format: DateFormat): String
Return the current formatted time string.
getString
Link copied to clipboard
open fun getString(time: String, timeSpan: Long, unit: Int): String
Return the formatted time string differ time span.
open fun getString(date: Date, timeSpan: Long, unit: Int): String
Return the formatted time string differ time span.
open fun getString(millis: Long, timeSpan: Long, unit: Int): String
Return the formatted time string differ time span.
open fun getString(time: String, format: DateFormat, timeSpan: Long, unit: Int): String
Return the formatted time string differ time span.
open fun getString(date: Date, format: DateFormat, timeSpan: Long, unit: Int): String
Return the formatted time string differ time span.
open fun getString(millis: Long, format: DateFormat, timeSpan: Long, unit: Int): String
Return the formatted time string differ time span.
getStringByNow
Link copied to clipboard
open fun getStringByNow(timeSpan: Long, unit: Int): String
Return the formatted time string differ time span by now.
open fun getStringByNow(timeSpan: Long, format: DateFormat, unit: Int): String
Return the formatted time string differ time span by now.
getTimeSpan
Link copied to clipboard
open fun getTimeSpan(time1: String, time2: String, unit: Int): Long
Return the time span, in unit.
open fun getTimeSpan(date1: Date, date2: Date, unit: Int): Long
Return the time span, in unit.
open fun getTimeSpan(millis1: Long, millis2: Long, unit: Int): Long
Return the time span, in unit.
open fun getTimeSpan(time1: String, time2: String, format: DateFormat, unit: Int): Long
Return the time span, in unit.
getTimeSpanByNow
Link copied to clipboard
open fun getTimeSpanByNow(time: String, unit: Int): Long
Return the time span by now, in unit.
open fun getTimeSpanByNow(date: Date, unit: Int): Long
Return the time span by now, in unit.
open fun getTimeSpanByNow(millis: Long, unit: Int): Long
Return the time span by now, in unit.
open fun getTimeSpanByNow(time: String, format: DateFormat, unit: Int): Long
Return the time span by now, in unit.
getUSWeek
Link copied to clipboard
open fun getUSWeek(time: String): String
Return the day of week in US.
open fun getUSWeek(date: Date): String
Return the day of week in US.
open fun getUSWeek(millis: Long): String
Return the day of week in US.
open fun getUSWeek(time: String, format: DateFormat): String
Return the day of week in US.
getWeekIndex
Link copied to clipboard
open fun getWeekIndex(time: String): Int
Return the number for indicating the day of the week.
open fun getWeekIndex(date: Date): Int
Return the number for indicating the day of the week.
open fun getWeekIndex(millis: Long): Int
Return the number for indicating the day of the week.
open fun getWeekIndex(time: String, format: DateFormat): Int
Return the number for indicating the day of the week.
getWeekOfMonth
Link copied to clipboard
open fun getWeekOfMonth(time: String): Int
Return the number for indicating the week number within the current month.
open fun getWeekOfMonth(date: Date): Int
Return the number for indicating the week number within the current month.
open fun getWeekOfMonth(millis: Long): Int
Return the number for indicating the week number within the current month.
open fun getWeekOfMonth(time: String, format: DateFormat): Int
Return the number for indicating the week number within the current month.
getWeekOfYear
Link copied to clipboard
open fun getWeekOfYear(time: String): Int
Return the number for indicating the week number within the current year.
open fun getWeekOfYear(date: Date): Int
Return the number for indicating the week number within the current year.
open fun getWeekOfYear(millis: Long): Int
Return the number for indicating the week number within the current year.
open fun getWeekOfYear(time: String, format: DateFormat): Int
Return the number for indicating the week number within the current year.
getZodiac
Link copied to clipboard
open fun getZodiac(time: String): String
Return the zodiac.
open fun getZodiac(date: Date): String
Return the zodiac.
open fun getZodiac(millis: Long): String
Return the zodiac.
open fun getZodiac(month: Int, day: Int): String
Return the zodiac.
open fun getZodiac(time: String, format: DateFormat): String
Return the zodiac.
isLeapYear
Link copied to clipboard
open fun isLeapYear(year: Int): Boolean
Return whether it is leap year.
open fun isLeapYear(time: String): Boolean
Return whether it is leap year.
open fun isLeapYear(date: Date): Boolean
Return whether it is leap year.
open fun isLeapYear(millis: Long): Boolean
Return whether it is leap year.
open fun isLeapYear(time: String, format: DateFormat): Boolean
Return whether it is leap year.
isToday
Link copied to clipboard
open fun isToday(time: String): Boolean
Return whether it is today.
open fun isToday(date: Date): Boolean
Return whether it is today.
open fun isToday(millis: Long): Boolean
Return whether it is today.
open fun isToday(time: String, format: DateFormat): Boolean
Return whether it is today.
millis2Date
Link copied to clipboard
open fun millis2Date(millis: Long): Date
Milliseconds to the date.
millis2String
Link copied to clipboard
open fun millis2String(millis: Long): String
Milliseconds to the formatted time string.
open fun millis2String(millis: Long, format: DateFormat): String
Milliseconds to the formatted time string.
string2Date
Link copied to clipboard
open fun string2Date(time: String): Date
Formatted time string to the date.
open fun string2Date(time: String, format: DateFormat): Date
Formatted time string to the date.
string2Millis
Link copied to clipboard
open fun string2Millis(time: String): Long
Formatted time string to the milliseconds.
open fun string2Millis(time: String, format: DateFormat): Long
Formatted time string to the milliseconds.