有哪些用例可以证明310 OffsetDate类型的合理性? [英] What are the use cases justifying the 310 OffsetDate type?

查看:45
本文介绍了有哪些用例可以证明310 OffsetDate类型的合理性?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

OffsetDate 表示带区域偏移的日期.我不理解此类服务的目的,证明其存在的主要用例是什么?

OffsetDate represents a date with a zone offset. I don't understand the purpose this class serves, what are the main use cases justifying its existence?

推荐答案

在分析日期和时间的基本组成部分时,有四个基本元素:

When analysing the basic components of dates and times there are four basic elements:

  • 日期
  • 时间
  • 偏移量(格林威治时间加/减小时)
  • 时区

这些自然地分为七个类:

These naturaly form seven classes:

  • LocalDate-仅日期
  • LocalTime-仅时间
  • LocalDateTime-日期和时间
  • OffsetDate-日期+偏移量
  • OffsetTime-时间+偏移量
  • OffsetDateTime-日期+时间+偏移量
  • ZonedDateTime-日期+时间+偏移量+区域

(只有在您知道日期和时间的情况下才能使用时区,因此没有ZonedDate或ZonedTime类)

(a time-zone can only be used if you know the date and the time, so there is no ZonedDate or ZonedTime class)

前六种形式直接匹配 XML模式的定义,该定义实际上是有效的证明他们的存在.在应用程序设计方面,我怀疑 OffsetDate 将是这七个类中使用最少的.

The first six forms directly match XML schema definitions, which in effect justifies their existence. In application design terms I suspect that OffsetDate will be the least used of the seven classes.

更新时间:2013年1月24日:OffsetDate 不会出现在 JDK 1.8中

Update: 2013-01-24: OffsetDate won't be in JDK 1.8.

这篇关于有哪些用例可以证明310 OffsetDate类型的合理性?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆