ibm-information-center/dist/eclipse/plugins/i5OS.ic.dbp_5.4.0.1/rbafodttarul.htm

72 lines
4.9 KiB
HTML

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html lang="en-us" xml:lang="en-us">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="security" content="public" />
<meta name="Robots" content="index,follow" />
<meta http-equiv="PICS-Label" content='(PICS-1.1 "http://www.icra.org/ratingsv02.html" l gen true r (cz 1 lz 1 nz 1 oz 1 vz 1) "http://www.rsac.org/ratingsv01.html" l gen true r (n 0 s 0 v 0 l 0) "http://www.classify.org/safesurf/" l gen true r (SS~~000 1))' />
<meta name="DC.Type" content="concept" />
<meta name="DC.Title" content="Rules for date, time, and timestamp arithmetic" />
<meta name="abstract" content="The only arithmetic operations that can be performed on date and time values are addition and subtraction. If a date or time value is the operand of addition, the other operand must be a duration. This topic describes rules for performing date, time and timestamp arithmetic." />
<meta name="description" content="The only arithmetic operations that can be performed on date and time values are addition and subtraction. If a date or time value is the operand of addition, the other operand must be a duration. This topic describes rules for performing date, time and timestamp arithmetic." />
<meta name="DC.Relation" scheme="URI" content="rbafodttaopq.htm" />
<meta name="copyright" content="(C) Copyright IBM Corporation 1998, 2006" />
<meta name="DC.Rights.Owner" content="(C) Copyright IBM Corporation 1998, 2006" />
<meta name="DC.Format" content="XHTML" />
<meta name="DC.Identifier" content="rbafodttarul" />
<meta name="DC.Language" content="en-us" />
<!-- All rights reserved. Licensed Materials Property of IBM -->
<!-- US Government Users Restricted Rights -->
<!-- Use, duplication or disclosure restricted by -->
<!-- GSA ADP Schedule Contract with IBM Corp. -->
<link rel="stylesheet" type="text/css" href="./ibmdita.css" />
<link rel="stylesheet" type="text/css" href="./ic.css" />
<title>Rules for date, time, and timestamp arithmetic</title>
</head>
<body id="rbafodttarul"><a name="rbafodttarul"><!-- --></a>
<!-- Java sync-link --><script language="Javascript" src="../rzahg/synch.js" type="text/javascript"></script>
<h1 class="topictitle1">Rules for date, time, and timestamp arithmetic</h1>
<div><p>The only arithmetic operations that can be performed on date and
time values are addition and subtraction. If a date or time value
is the operand of addition, the other operand must be a duration. This topic
describes rules for performing date, time and timestamp arithmetic.</p>
<div class="p"> The specific rules governing the use of the addition operator with date
and time values follow: <ul><li>If one operand is a date, the other operand must be a date duration or
a labeled duration of years, months, or days.</li>
<li>If one operand is a time, the other operand must be a time duration or
a labeled duration of hours, minutes, or seconds.</li>
<li>If one operand is a timestamp, the other operand must be a duration. Any
type of duration is valid.</li>
</ul>
</div>
<div class="p">The rules for the use of the subtraction operator on date and time values
are not the same as those for addition because a date or time value cannot
be subtracted from a duration, and because the operation of subtracting two
date and time values is not the same as the operation of subtracting a duration
from a date or time value. The specific rules governing the use of the subtraction
operator with date and time values follow: <ul><li>If the first operand is a date, the second operand must be a date, a date
duration, a string representation of a date, or a labeled duration of years,
months, or days.</li>
<li>If the second operand is a date, the first operand must be a date or a
string representation of a date.</li>
<li>If the first operand is a time, the second operand must be a time, a time
duration, a string representation of a time, or a labeled duration of hours,
minutes, or seconds.</li>
<li>If the second operand is a time, the first operand must be a time or string
representation of a time.</li>
<li>If the first operand is a timestamp, the second operand must be a timestamp,
a string representation of a timestamp, or a duration.</li>
<li>If the second operand is a timestamp, the first operand must be a timestamp
or a string representation of a timestamp.</li>
</ul>
</div>
</div>
<div>
<div class="familylinks">
<div class="parentlink"><strong>Parent topic:</strong> <a href="rbafodttaopq.htm" title="Date, time, and timestamp values can be incremented, decremented, and subtracted. These operations might involve decimal numbers called durations. These topics include a definition of durations and a specification of the rules for performing arithmetic operations on date, time, and timestamp values.">Perform date, time, and timestamp arithmetic using the Open Query File (OPNQRYF) command</a></div>
</div>
</div>
</body>
</html>