All Downloads are FREE. Search and download functionalities are using the official Maven repository.

net.chestmc.common.extensions.numbers.Times.kt Maven / Gradle / Ivy

package net.chestmc.common.extensions.numbers

import org.joda.time.*
import java.util.*

/**
 * Converts this number as date.
 */
fun Number.toDate(): Date = Date(toLong())

/**
 * Converts this number to a local date.
 */
fun Number.toLocalDate(): LocalDate = LocalDate(toLong())

/**
 * Converts this number to a date time.
 */
fun Number.toDateTime(): DateTime = DateTime(toLong())

/**
 * Converts this number to a local date.
 */
fun Number.toLocalDateTime(): LocalDateTime = LocalDateTime(toLong())

/**
 * Converts this number to seconds.
 */
fun Number.toSeconds(): Seconds = Seconds.seconds(toInt())

/**
 * Converts this number to minutes.
 */
fun Number.toMinutes(): Minutes = Minutes.minutes(toInt())

/**
 * Converts this number to hours.
 */
fun Number.toHours(): Hours = Hours.hours(toInt())

/**
 * Converts this number to days.
 */
fun Number.toDays(): Days = Days.days(toInt())

/**
 * Converts this number to weeks.
 */
fun Number.toWeeks(): Weeks = Weeks.weeks(toInt())

/**
 * Converts this number to months.
 */
fun Number.toMonths(): Months = Months.months(toInt())

/**
 * Converts this number to years.
 */
fun Number.toYears(): Years = Years.years(toInt())




© 2015 - 2025 Weber Informatics LLC | Privacy Policy