toString

fun Calendar.toString(format: String): String

Deprecated

This function is deprecated and will be removed in next major release.Use format() instead.

Replace with

import com.parsuomash.affogato.core.ktx.datetime.format
format(format)

Formats a Calendar into a date-time String.

Since

1.1.0

Return

The formatted date-time string.

See also

Throws

IllegalArgumentException

if the given pattern is invalid


fun Date.toString(format: String): String

Deprecated

This function is deprecated and will be removed in next major release.Use format() instead.

Replace with

import com.parsuomash.affogato.core.ktx.datetime.format
format(format)

Formats a Date into a date-time String.

Example:

1659814200000.toDate().toString("MM/dd/yyyy") // 08/07/2022

Since

1.1.0

Return

The formatted date-time string.

See also

Throws

IllegalArgumentException

if the given pattern is invalid


fun Instant.toString(format: String): String

Deprecated

This function is deprecated and will be removed in next major release.Use format() instead.

Replace with

import com.parsuomash.affogato.core.ktx.datetime.format
format(format)

Formats a Instant into a date-time String.

Example:

1659814200000.toInstant().toString("MM/dd/yyyy") // 08/07/2022

Since

1.1.0

Return

The formatted date-time string.

See also

Throws

IllegalArgumentException

if the given pattern is invalid


fun LocalDate.toString(format: String): String

Deprecated

This function is deprecated and will be removed in next major release.Use format() instead.

Replace with

import com.parsuomash.affogato.core.ktx.datetime.format
format(format)

Formats a LocalDate into a date-time String.

Example:

1659814200000.toLocalDate().toString("MM/dd/yyyy") // 08/07/2022

Since

1.1.0

Return

The formatted date-time string.

See also

Throws

IllegalArgumentException

if the given pattern is invalid


fun LocalDateTime.toString(format: String): String

Deprecated

This function is deprecated and will be removed in next major release.Use format() instead.

Replace with

import com.parsuomash.affogato.core.ktx.datetime.format
format(format)

Formats a LocalDateTime into a date-time String.

Example:

1659814205950.toLocalDateTime().toString("MM/dd/yyyy") // 08/07/2022

Since

1.1.0

Return

The formatted date-time string.

See also

Throws

IllegalArgumentException

if the given pattern is invalid


fun LocalTime.toString(format: String): String

Deprecated

This function is deprecated and will be removed in next major release.Use format() instead.

Replace with

import com.parsuomash.affogato.core.ktx.datetime.format
format(format)

Formats a LocalTime into a date-time String.

Example:

val time = LocalTime(11, 10, 0)
time.toLocalDate().toString("HH") // 11

Since

1.1.0

Return

The formatted date-time string.

See also

Throws

IllegalArgumentException

if the given pattern is invalid