Print      Open PDF Version of Online Help


Previous Topic

Next Topic

Duration

The Duration function in Expression Builder returns a number that indicates a period in days or fractions of days as indicated by the period argument.

Syntax

Duration(period)

Result Type

Number

Arguments

The following table describes the arguments for the function.

Argument

Description

Period

A string literal in the following format PnYnMnDTnHnM:

where:

  • P is the period indicator
  • nY specifies the number of years between 0 and 5
  • nM specifies the number of months between 0 and 12
  • nD specifies the number of days between 0 and 200
  • T separates the date and time specifications
  • nH specifies the number of hours between 0 and 200
  • nM specifies the number of minutes between 0 and 59

Note the following points:

  • Do not specify a plus sign (+) for positive values.
  • You can specify a negative duration as -Duration(Period).
  • Specifying seconds is not supported.
  • The maximum supported duration is 'P5Y12M200DT200H59M' (that is, 5 years, 12 months, 200 days, 200 hours, and 59 minutes).
  • If the number of years, months, days, hours, or minutes is zero, you can omit the number and its corresponding designator.
  • If the number of years, months, or days is zero and the time component is a nonzero value, at least one of the year, month, or day components (a number and its designator) must be present.
  • If none of the time components are present in the period, the T designator must not be included in the period.
  • The designator P must always be present in the period.

Examples

The following are valid examples of the Duration function:

Duration('P0Y1M1DT2H5M')

Duration('P0Y0DT1H')

Duration('P1D')

Duration('P0Y0M0DT0H0M')

Duration('P0DT1M')

Related Topics

See the following topics for related Expression Builder information:


Published 8/22/2016 Copyright © 2005, 2016, Oracle. All rights reserved. Legal Notices.