XSD 日期数据类型

Date and time data types are used for values that contain date and time.
日期和时间数据类型(Date and time data types)用于定义日期和时间数据的。


Date Data Type
日期数据类型

The date data type is used to specify a date.
日期数据类型用于指定一个具体的日期

The date is specified in the following form "YYYY-MM-DD" where:
日期由下面的"YYYY-MM-DD"形式指定。

  • YYYY indicates the year
     YYYY指示年份
  • MM indicates the month
    MM指示月份
  • DD indicates the day
    DD 指示日期

Note: All components are required!
注意:所有组件都是必需的。

The following is an example of a date declaration in a schema:
下面是schema(XML公式)里的声明日期的例子

<xs:element name="start" type="xs:date"/>

An element in your document might look like this:
你文档中的某个元素也许是这样的:

<start>2002-09-24</start>

Time Zones
时间区

To specify a time zone, you can either enter a date in UTC time by adding a "Z" behind the date - like this:
为指定一个时间区,你既可以通过在日期的后面加个"Z"访问UTC时间格式的日期,就像这样:

<start>2002-09-24Z</start>

or you can specify an offset from the UTC time by adding a positive or negative time behind the date - like this:
也可以UTC时间后加、减一个时间值,就像这样:

<start>2002-09-24-06:00</start>
or
<start>2002-09-24+06:00</start>


Time Data Type
时间数据类型

The time data type is used to specify a time.
时间数据类型用于指定一个时间

The time is specified in the following form "hh:mm:ss" where:
时间由下面的"hh:mm:ss"形式指定:

  • hh indicates the hour
    hh指示小时
  • mm indicates the minute
    mm 指示分钟
  • ss indicates the second
    ss指示秒钟

Note: All components are required!
注意:所有的组件都是必需的

The following is an example of a time declaration in a schema:
下面是schema(XML公式)里的时间声明的例子

<xs:element name="start" type="xs:time"/>

An element in your document might look like this:
你文档中或许有这样的元素:

<start>09:00:00</start>

Or it might look like this:
或者是这样的:

<start>09:30:10.5</start>

Time Zones
时间区

To specify a time zone, you can either enter a time in UTC time by adding a "Z" behind the time - like this:
为指定一个时间区,你既可以通过在日期的后面加个"Z"访问UTC时间格式的日期,就像这样:

<start>09:30:10Z</start>

or you can specify an offset from the UTC time by adding a positive or negative time behind the time - like this:
也可以UTC时间后加、减一个时间值,就像这样:

<start>09:30:10-06:00</start>
or
<start>09:30:10+06:00</start>


DateTime Data Type
日期时间数据类型(DateTime Data Type)

The dateTime data type is used to specify a date and a time.
日期时间数据类型用于指定一个日期和一个时间

The dateTime is specified in the following form "YYYY-MM-DDThh:mm:ss" where:
日期时间由"YYYY-MM-DDThh:mm:ss"的形式指定:

  • YYYY indicates the year
    YYYY指示时间
  • MM indicates the month
    MM指示月份
  • DD indicates the day
    DD 指示时间
  • T indicates the start of the required time section
    T指示时间区的开头
  • hh indicates the hour
    hh指示小时
  • mm indicates the minute
    mm指示分钟
  • ss indicates the second
    ss指示秒钟

Note: All components are required!
注意:所有组件都是必需的

The following is an example of a dateTime declaration in a schema:
下面是schema(XML公式)里的日期时间声明的例子

<xs:element name="startdate" type="xs:dateTime"/>

An element in your document might look like this:
你文档中或许有这样的元素:

<startdate>2002-05-30T09:00:00</startdate>

Or it might look like this:
或者是这样的:

<startdate>2002-05-30T09:30:10.5</startdate>

Time Zones
时间区

To specify a time zone, you can either enter a dateTime in UTC time by adding a "Z" behind the time - like this:
为指定一个时间区,你既可以通过在日期的后面加个"Z"访问UTC时间格式的日期,就像这样:

<startdate>2002-05-30T09:30:10Z</startdate>

or you can specify an offset from the UTC time by adding a positive or negative time behind the time - like this:
也可以UTC时间后加、减一个时间值,就像这样:

<startdate>2002-05-30T09:30:10-06:00</startdate>
or
<startdate>2002-05-30T09:30:10+06:00</startdate>


Duration Data Type
持续时间数据类型(或“时间段数据类型”)(Duration Data Type)

The duration data type is used to specify a time interval.
持续时间数据类型(或“时间段数据类型”)用于定义一段时间间隔

The time interval is specified in the following form "PnYnMnDTnHnMnS" where:
时间间隔由"PnYnMnDTnHnMnS"形式定义的

  • P indicates the period (required)
    P指示
  • nY indicates the number of years
    nY指示年数
  • nM indicates the number of months
    nM指示月数
  • nD indicates the number of days
    nD指示天数
  • T indicates the start of a time section (required if you are going to specify hours, minutes, or seconds)
    T指示时间部分的开头(如果你要指定时间,分钟,或秒数,就必须用到T)
  • nH indicates the number of hours
    nH指示小时数
  • nM indicates the number of minutes
    nM指示分钟数
  • nS indicates the number of seconds
    nS指示秒数

The following is an example of a duration declaration in a schema:
下面是schema(XML公式)里的时间段声明的例子

<xs:element name="period" type="xs:duration"/>

An element in your document might look like this:
你文档中或许有这样的元素:

<period>P5Y</period>

The example above indicates a period of five years.
上面的例子指示了5年的时间段

Or it might look like this:
或者也可以像这样:

<period>P5Y2M10D</period>

The example above indicates a period of five years, two months, and 10 days.
上面的例子指出了5年2个月零10天的时间段

Or it might look like this:
它也可以这样:

<period>P5Y2M10DT15H</period>

The example above indicates a period of five years, two months, 10 days, and 15 hours.
上面的例子指出了5年2个月零10天的时间段

Or it might look like this:
或者它会是可以这样:

<period>PT15H</period>

The example above indicates a period of 15 hours.
上面的例子指出了15小时的时间段

Negative Duration
负时间段

To specify a negative duration, enter a minus sign before the P:
为定义负的时间段,在P之前添个负号

<period>-P10D</period>

The example above indicates a period of minus 10 days.
上面的例子指出里负10天的时间段


Date and Time Data Types
日期和时间数据类型

Name
名称
Description
解释
dateDefines a date value
定义日期的值
dateTimeDefines a date and time value
定义了日期和时间值
durationDefines a time interval
定义了时间间隔
gDayDefines a part of a date - the day (DD)
定义了日期的部分定义了时间的一部分——日部分(DD)
gMonthDefines a part of a date - the month (MM)
定义了日期的一部分——月部分(MM)
gMonthDayDefines a part of a date - the month and day (MM-DD)
定义了日期的一部分——月和日部分(MM-DD)
gYearDefines a part of a date - the year (YYYY)
定义了日期的年部分(YYYY)
gYearMonthDefines a part of a date - the year and month (YYYY-MM)
定义了日期的一部分——年和月部分(YYYY-MM)
timeDefines a time value
定义时间值


Restrictions on Date Data Types
对日期数据类型的约束

Restrictions that can be used with Date data types:
对日期数据类型可进行约束

  • enumeration
    列举
  • maxExclusive
    除去最大值
  • maxInclusive
    包括最大值
  • minExclusive
    除去最小值排外
  • minInclusive
    包括最小值
  • pattern
    式样
  • whiteSpace
    空白

 
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
提供的源码资源涵盖了Java应用等多个领域,每个领域都包含了丰富的实例和项目。这些源码都是基于各自平台的最新技术和标准编写,确保了在对应环境下能够无缝运行。同时,源码中配备了详细的注释和文档,帮助用户快速理解代码结构和实现逻辑。 适用人群: 适合毕业设计、课程设计作业。这些源码资源特别适合大学生群体。无论你是计算机相关专业的学生,还是对其他领域编程感兴趣的学生,这些资源都能为你提供宝贵的学习和实践机会。通过学习和运行这些源码,你可以掌握各平台开发的基础知识,提升编程能力和项目实战经验。 使用场景及目标: 在学习阶段,你可以利用这些源码资源进行课程实践、课外项目或毕业设计。通过分析和运行源码,你将深入了解各平台开发的技术细节和最佳实践,逐步培养起自己的项目开发和问题解决能力。此外,在求职或创业过程中,具备跨平台开发能力的大学生将更具竞争力。 其他说明: 为了确保源码资源的可运行性和易用性,特别注意了以下几点:首先,每份源码都提供了详细的运行环境和依赖说明,确保用户能够轻松搭建起开发环境;其次,源码中的注释和文档都非常完善,方便用户快速上手和理解代码;最后,我会定期更新这些源码资源,以适应各平台技术的最新发展和市场需求。 所有源码均经过严格测试,可以直接运行,可以放心下载使用。有任何使用问题欢迎随时与博主沟通,第一时间进行解答!

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值