sealed trait Format extends AnyRef
Serializable
wrapper around DateTimeFormatter
.
The main purpose of this is to make java8 codecs Serializable
and thus usable with frameworks like spark.
- Source
- Format.scala
- Alphabetic
- By Inheritance
- Format
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Abstract Value Members
- abstract def formatter: DateTimeFormatter
Internal date/time formatter.
Internal date/time formatter.
This is protected to prevent anyone from calling it directly - doing so instantly turns the calling class non-serializable, which rather defeats the purpose of Format.
- Attributes
- protected
Concrete Value Members
- final def !=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def ##: Int
- Definition Classes
- AnyRef → Any
- final def ==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- def clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @native()
- final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def equals(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef → Any
- def finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.Throwable])
- def format(temporal: TemporalAccessor): String
Formats the specified
TemporalAccessor
as a string.Formats the specified
TemporalAccessor
as a string.scala> import java.time._ scala> Format.defaultZonedDateTimeFormat | .format(ZonedDateTime.of(2000, 1, 1, 12, 0, 0, 0, ZoneOffset.UTC)) res1: String = 2000-01-01T12:00:00Z
Example: - final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- def hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- final def ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- final def notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- def parseInstant(str: String): StringResult[Instant]
Attempts to parse the specified string as an
Instant
.Attempts to parse the specified string as an
Instant
.scala> import java.time._ scala> import kantan.codecs.strings._ scala> Format.defaultInstantFormat | .parseInstant("2000-01-01T12:00:00.000Z") res1: StringResult[Instant] = Right(2000-01-01T12:00:00Z)
Example: - def parseLocalDate(str: String): StringResult[LocalDate]
Attempts to parse the specified string as a
LocalDate
.Attempts to parse the specified string as a
LocalDate
.scala> import java.time._ scala> import kantan.codecs.strings._ scala> Format.defaultLocalDateFormat | .parseLocalDate("2000-01-01") res2: StringResult[LocalDate] = Right(2000-01-01)
Example: - def parseLocalDateTime(str: String): StringResult[LocalDateTime]
Attempts to parse the specified string as a
LocalDateTime
.Attempts to parse the specified string as a
LocalDateTime
.scala> import java.time._ scala> import kantan.codecs.strings._ scala> Format.defaultLocalDateTimeFormat | .parseLocalDateTime("2000-01-01T12:00:00.000") res2: StringResult[LocalDateTime] = Right(2000-01-01T12:00)
Example: - def parseLocalTime(str: String): StringResult[LocalTime]
Attempts to parse the specified string as a
LocalDateTime
.Attempts to parse the specified string as a
LocalDateTime
.scala> import java.time._ scala> import kantan.codecs.strings._ scala> Format.defaultLocalTimeFormat | .parseLocalTime("12:00:00.000") res1: StringResult[LocalTime] = Right(12:00)
Example: - def parseOffsetDateTime(str: String): StringResult[OffsetDateTime]
Attempts to parse the specified string as a
LocalDate
.Attempts to parse the specified string as a
LocalDate
.scala> import java.time._ scala> import kantan.codecs.strings._ scala> Format.defaultOffsetDateTimeFormat | .parseOffsetDateTime("2000-01-01T12:00:00.000Z") res1: StringResult[OffsetDateTime] = Right(2000-01-01T12:00Z)
Example: - def parseZonedDateTime(str: String): StringResult[ZonedDateTime]
Attempts to parse the specified string as a
ZonedDateTime
.Attempts to parse the specified string as a
ZonedDateTime
.scala> import java.time._ scala> import kantan.codecs.strings._ scala> Format.defaultZonedDateTimeFormat | .parseZonedDateTime("2000-01-01T12:00:00.000Z") res1: StringResult[ZonedDateTime] = Right(2000-01-01T12:00Z)
Example: - final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- def toString(): String
- Definition Classes
- AnyRef → Any
- final def wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException]) @native()