src/Pure/General/date.scala
changeset 64111 b2290b9d0175
parent 64100 9b1573213ebe
child 64117 c2b41b073d8a
equal deleted inserted replaced
64110:c0b96b34c7b9 64111:b2290b9d0175
    83     new Date(ZonedDateTime.ofInstant(t.instant, zone))
    83     new Date(ZonedDateTime.ofInstant(t.instant, zone))
    84 }
    84 }
    85 
    85 
    86 sealed case class Date(rep: ZonedDateTime)
    86 sealed case class Date(rep: ZonedDateTime)
    87 {
    87 {
       
    88   def to(zone: ZoneId): Date = new Date(rep.withZoneSameInstant(zone))
       
    89   def to_utc: Date = to(ZoneId.of("UTC"))
       
    90 
    88   def time: Time = Time.instant(Instant.from(rep))
    91   def time: Time = Time.instant(Instant.from(rep))
    89   def timezone: ZoneId = rep.getZone
    92   def timezone: ZoneId = rep.getZone
    90 
    93 
    91   def format(fmt: Date.Format = Date.Format.default): String = fmt(this)
    94   def format(fmt: Date.Format = Date.Format.default): String = fmt(this)
    92   override def toString: String = format()
    95   override def toString: String = format()