Explorar o código

+ Next batch of functions documented

michael %!s(int64=20) %!d(string=hai) anos
pai
achega
69d549cf75

+ 477 - 5
docs/dateutils.xml

@@ -3142,6 +3142,7 @@ years). This means the fractional part of a year is dropped.
 <link id="MinutesBetween"/>
 <link id="SecondsBetween"/>
 <link id="MilliSecondsBetween"/>
+<link id="YearSpan"/>
 </seealso>
 <example file="datutex/ex55"/>
 </element>
@@ -3415,6 +3416,23 @@ This means a fractional part of a millisecond is dropped.
 <!-- function result Visibility: default -->
 <element name="YearSpan.Result">
 <short>Number (fractions included) of years between <var>ANow</var> and <var>AThen</var></short>
+<descr>
+<var>YearSpan</var> returns the number of years between <var>ANow</var> and
+<var>AThen</var>, including any fractional parts of a year. This number is an approximation,
+based on an average number of days of 365.25 per year (average over 4
+years). 
+</descr>
+<seealso>
+<link id="MonthSpan"/>
+<link id="WeekSpan"/>
+<link id="DaySpan"/>
+<link id="HourSpan"/>
+<link id="MinuteSpan"/>
+<link id="SecondSpan"/>
+<link id="MilliSecondSpan"/>
+<link id="YearsBetween"/>
+</seealso>
+<example file="datutex/ex63"/>
 </element>
 
 <!-- argument Visibility: default -->
@@ -3430,6 +3448,23 @@ This means a fractional part of a millisecond is dropped.
 <!-- function Visibility: default -->
 <element name="MonthSpan">
 <short>Calculate the approximate number of months between two DateTime values.</short>
+<descr>
+<var>MonthSpan</var> returns the number of month between <var>ANow</var> and
+<var>AThen</var>, including any fractional parts of a month. This number is an approximation,
+based on an average number of days of 30.4375 per month (average over 4
+years). 
+</descr>
+<seealso>
+<link id="YearSpan"/>
+<link id="WeekSpan"/>
+<link id="DaySpan"/>
+<link id="HourSpan"/>
+<link id="MinuteSpan"/>
+<link id="SecondSpan"/>
+<link id="MilliSecondSpan"/>
+<link id="MonthsBetween"/>
+</seealso>
+<example file="datutex/ex64"/>
 </element>
 
 <!-- function result Visibility: default -->
@@ -3450,6 +3485,21 @@ This means a fractional part of a millisecond is dropped.
 <!-- function Visibility: default -->
 <element name="WeekSpan">
 <short>Calculate the approximate number of weeks between two DateTime values.</short>
+<descr>
+<var>WeekSpan</var> returns the number of weeks between <var>ANow</var> and
+<var>AThen</var>, including any fractional parts of a week. 
+</descr>
+<seealso>
+<link id="YearSpan"/>
+<link id="MonthSpan"/>
+<link id="DaySpan"/>
+<link id="HourSpan"/>
+<link id="MinuteSpan"/>
+<link id="SecondSpan"/>
+<link id="MilliSecondSpan"/>
+<link id="WeeksBetween"/>
+</seealso>
+<example file="datutex/ex65"/>
 </element>
 
 <!-- function result Visibility: default -->
@@ -3470,6 +3520,21 @@ This means a fractional part of a millisecond is dropped.
 <!-- function Visibility: default -->
 <element name="DaySpan">
 <short>Calculate the approximate number of days between two DateTime values.</short>
+<descr>
+<var>DaySpan</var> returns the number of Days between <var>ANow</var> and
+<var>AThen</var>, including any fractional parts of a Day. 
+</descr>
+<seealso>
+<link id="YearSpan"/>
+<link id="MonthSpan"/>
+<link id="WeekSpan"/>
+<link id="HourSpan"/>
+<link id="MinuteSpan"/>
+<link id="SecondSpan"/>
+<link id="MilliSecondSpan"/>
+<link id="DaysBetween"/>
+</seealso>
+<example file="datutex/ex66"/>
 </element>
 
 <!-- function result Visibility: default -->
@@ -3490,6 +3555,21 @@ This means a fractional part of a millisecond is dropped.
 <!-- function Visibility: default -->
 <element name="HourSpan">
 <short>Calculate the approximate number of hours between two DateTime values.</short>
+<descr>
+<var>HourSpan</var> returns the number of Hours between <var>ANow</var> and
+<var>AThen</var>, including any fractional parts of a Hour. 
+</descr>
+<seealso>
+<link id="YearSpan"/>
+<link id="MonthSpan"/>
+<link id="WeekSpan"/>
+<link id="DaySpan"/>
+<link id="MinuteSpan"/>
+<link id="SecondSpan"/>
+<link id="MilliSecondSpan"/>
+<link id="HoursBetween"/>
+</seealso>
+<example file="datutex/ex67"/>
 </element>
 
 <!-- function result Visibility: default -->
@@ -3510,6 +3590,21 @@ This means a fractional part of a millisecond is dropped.
 <!-- function Visibility: default -->
 <element name="MinuteSpan">
 <short>Calculate the approximate number of minutes between two DateTime values.</short>
+<descr>
+<var>MinuteSpan</var> returns the number of minutes between <var>ANow</var> and
+<var>AThen</var>, including any fractional parts of a minute. 
+</descr>
+<seealso>
+<link id="YearSpan"/>
+<link id="MonthSpan"/>
+<link id="WeekSpan"/>
+<link id="DaySpan"/>
+<link id="HourSpan"/>
+<link id="SecondSpan"/>
+<link id="MilliSecondSpan"/>
+<link id="MinutesBetween"/>
+</seealso>
+<example file="datutex/ex68"/>
 </element>
 
 <!-- function result Visibility: default -->
@@ -3530,6 +3625,21 @@ This means a fractional part of a millisecond is dropped.
 <!-- function Visibility: default -->
 <element name="SecondSpan">
 <short>Calculate the approximate number of seconds between two DateTime values.</short>
+<descr>
+<var>SecondSpan</var> returns the number of seconds between <var>ANow</var> and
+<var>AThen</var>, including any fractional parts of a second. 
+</descr>
+<seealso>
+<link id="YearSpan"/>
+<link id="MonthSpan"/>
+<link id="WeekSpan"/>
+<link id="DaySpan"/>
+<link id="HourSpan"/>
+<link id="MinuteSpan"/>
+<link id="MilliSecondSpan"/>
+<link id="SecondsBetween"/>
+</seealso>
+<example file="datutex/ex69"/>
 </element>
 
 <!-- function result Visibility: default -->
@@ -3549,13 +3659,24 @@ This means a fractional part of a millisecond is dropped.
 
 <!-- function Visibility: default -->
 <element name="MilliSecondSpan">
-<short>alculate the approximate number of seconds between two DateTime values.</short>
+<short>Calculate the approximate number of milliseconds between two DateTime values.</short>
 <descr>
-<p>
-Since millisecond are the smallest unit of a <var>TDateTime</var> value, the number
-will always be an integer value, even though a double is returned.
-</p>
+<var>MilliSecondSpan</var> returns the number of milliseconds between <var>ANow</var> and
+<var>AThen</var>. Since millisecond is the smallest fraction of a
+<var>TDateTime</var> indication, the returned number will always be an
+integer value.
 </descr>
+<seealso>
+<link id="YearSpan"/>
+<link id="MonthSpan"/>
+<link id="WeekSpan"/>
+<link id="DaySpan"/>
+<link id="HourSpan"/>
+<link id="MinuteSpan"/>
+<link id="SecondSpan"/>
+<link id="MilliSecondsBetween"/>
+</seealso>
+<example file="datutex/ex70"/>
 </element>
 
 <!-- function result Visibility: default -->
@@ -3576,6 +3697,21 @@ will always be an integer value, even though a double is returned.
 <!-- function Visibility: default -->
 <element name="IncYear">
 <short>Increase a DateTime value with a number of years.</short>
+<descr>
+<var>IncYear</var> adds <var>ANumberOfYears</var> years to <var>AValue</var> and
+returns the resulting date/time. <var>ANumberOfYears</var> can be positive or
+negative. 
+</descr>
+<seealso>
+<link id="#rtl.sysutils.IncMonth"/>
+<link id="IncWeek"/>
+<link id="IncDay"/>
+<link id="IncHour"/>
+<link id="IncMinute"/>
+<link id="IncSecond"/>
+<link id="IncMilliSecond"/>
+</seealso>
+<example file="datutex/ex71"/>
 </element>
 
 <!-- function result Visibility: default -->
@@ -3588,6 +3724,12 @@ will always be an integer value, even though a double is returned.
 <short>DateTime to which years should be added.</short>
 </element>
 
+<!-- argument Visibility: default -->
+<element name="IncYear.ANumberOfYears">
+<short>Number of years to add</short>
+</element>
+
+
 <!-- argument Visibility: default -->
 <element name="IncWeek.ANumberOfWeeks">
 <short>Number of weeks to add</short>
@@ -3596,6 +3738,21 @@ will always be an integer value, even though a double is returned.
 <!-- function Visibility: default -->
 <element name="IncWeek">
 <short>Increase a DateTime value with a number of weeks.</short>
+<descr>
+<var>IncWeek</var> adds <var>ANumberOfWeeks</var> weeks to <var>AValue</var> and
+returns the resulting date/time.<var>ANumberOfWeeks</var> can be positive or
+negative.
+</descr>
+<seealso>
+<link id="IncYear"/>
+<link id="#rtl.sysutils.IncMonth"/>
+<link id="IncDay"/>
+<link id="IncHour"/>
+<link id="IncMinute"/>
+<link id="IncSecond"/>
+<link id="IncMilliSecond"/>
+</seealso>
+<example file="datutex/ex73"/>
 </element>
 
 <!-- function result Visibility: default -->
@@ -3617,6 +3774,21 @@ will always be an integer value, even though a double is returned.
 <!-- function Visibility: default -->
 <element name="IncDay">
 <short>Increase a DateTime value with a number of days.</short>
+<descr>
+<var>IncDay</var> adds <var>ANumberOfDays</var> days to <var>AValue</var> and
+returns the resulting date/time.<var>ANumberOfDays</var> can be positive or
+negative.
+</descr>
+<seealso>
+<link id="IncYear"/>
+<link id="#rtl.sysutils.IncMonth"/>
+<link id="IncWeek"/>
+<link id="IncHour"/>
+<link id="IncMinute"/>
+<link id="IncSecond"/>
+<link id="IncMilliSecond"/>
+</seealso>
+<example file="datutex/ex74"/>
 </element>
 
 <!-- function result Visibility: default -->
@@ -3637,6 +3809,21 @@ will always be an integer value, even though a double is returned.
 <!-- function Visibility: default -->
 <element name="IncHour">
 <short>Increase a DateTime value with a number of hours.</short>
+<descr>
+<var>IncHour</var> adds <var>ANumberOfHours</var> hours to <var>AValue</var> and
+returns the resulting date/time.<var>ANumberOfHours</var> can be positive or
+negative.
+</descr>
+<seealso>
+<link id="IncYear"/>
+<link id="#rtl.sysutils.IncMonth"/>
+<link id="IncWeek"/>
+<link id="IncDay"/>
+<link id="IncMinute"/>
+<link id="IncSecond"/>
+<link id="IncMilliSecond"/>
+</seealso>
+<example file="datutex/ex75"/>
 </element>
 
 <!-- function result Visibility: default -->
@@ -3657,6 +3844,21 @@ will always be an integer value, even though a double is returned.
 <!-- function Visibility: default -->
 <element name="IncMinute">
 <short>Increase a DateTime value with a number of minutes.</short>
+<descr>
+<var>IncMinute</var> adds <var>ANumberOfMinutes</var> minutes to <var>AValue</var> and
+returns the resulting date/time.<var>ANumberOfMinutes</var> can be positive or
+negative.
+</descr>
+<seealso>
+<link id="IncYear"/>
+<link id="#rtl.sysutils.IncMonth"/>
+<link id="IncWeek"/>
+<link id="IncDay"/>
+<link id="IncHour"/>
+<link id="IncSecond"/>
+<link id="IncMilliSecond"/>
+</seealso>
+<example file="datutex/ex76"/>
 </element>
 
 <!-- function result Visibility: default -->
@@ -3677,6 +3879,21 @@ will always be an integer value, even though a double is returned.
 <!-- function Visibility: default -->
 <element name="IncSecond">
 <short>Increase a DateTime value with a number of seconds.</short>
+<descr>
+<var>IncSecond</var> adds <var>ANumberOfSeconds</var> seconds to <var>AValue</var> and
+returns the resulting date/time.<var>ANumberOfSeconds</var> can be positive or
+negative.
+</descr>
+<seealso>
+<link id="IncYear"/>
+<link id="#rtl.sysutils.IncMonth"/>
+<link id="IncWeek"/>
+<link id="IncDay"/>
+<link id="IncHour"/>
+<link id="IncSecond"/>
+<link id="IncMilliSecond"/>
+</seealso>
+<example file="datutex/ex77"/>
 </element>
 
 <!-- function result Visibility: default -->
@@ -3697,6 +3914,21 @@ will always be an integer value, even though a double is returned.
 <!-- function Visibility: default -->
 <element name="IncMilliSecond">
 <short>Increase a DateTime value with a number of milliseconds.</short>
+<descr>
+<var>IncMilliSecond</var> adds <var>ANumberOfMilliSeconds</var> milliseconds to <var>AValue</var> and
+returns the resulting date/time.<var>ANumberOfMilliSeconds</var> can be positive or
+negative.
+</descr>
+<seealso>
+<link id="IncYear"/>
+<link id="#rtl.sysutils.IncMonth"/>
+<link id="IncWeek"/>
+<link id="IncDay"/>
+<link id="IncHour"/>
+<link id="IncSecond"/>
+<link id="IncMilliSecond"/>
+</seealso>
+<example file="datutex/ex78"/>
 </element>
 
 <!-- function result Visibility: default -->
@@ -3712,6 +3944,31 @@ will always be an integer value, even though a double is returned.
 <!-- function Visibility: default -->
 <element name="EncodeDateTime">
 <short>Encodes a DateTime value from all its parts</short>
+<descr>
+<p>
+<var>EncodeDateTime</var> encodes the values <var>AYear</var>
+<var>AMonth</var>, <var>ADay</var>,<var>AHour</var>,
+<var>AMinute</var>,<var>ASecond</var> and <var>AMilliSecond</var>
+to a date/time valueand returns this value.
+</p>
+<p>
+For an example, see <link id="DecodeDateTime"/>.
+</p>
+</descr>
+<errors>
+If any of the arguments is not valid, then an <var>EConvertError</var>
+exception is raised.
+</errors>
+<seealso>
+<link id="DecodeDateTime"/>
+<link id="EncodeDateMonthWeek"/>
+<link id="EncodeDateWeek"/>
+<link id="EncodeDateDay"/>
+<link id="TryEncodeDateTime"/>
+<link id="TryEncodeDateWeek"/>
+<link id="TryEncodeDateDay"/>
+<link id="TryEncodeDateMonthWeek"/>
+</seealso>
 </element>
 
 <!-- function result Visibility: default -->
@@ -3757,6 +4014,22 @@ will always be an integer value, even though a double is returned.
 <!-- procedure Visibility: default -->
 <element name="DecodeDateTime">
 <short>Decode a datetime value in a date and time value</short>
+<descr>
+<var>DecodeDateTime</var> decomposes the date/time indication in
+<var>AValue</var> and returns the various components in <var>AYear</var>,
+<var>AMonth</var>, <var>ADay</var>, <var>AHour</var>, <var>AMinute</var>,
+<var>ASecond</var>, <var>AMilliSecond</var>
+</descr>
+<seealso>
+<link id="EncodeDateTime"/>
+<link id="EncodeDateMonthWeek"/>
+<link id="EncodeDateWeek"/>
+<link id="EncodeDateDay"/>
+<link id="DecodeDateWeek"/>
+<link id="DecodeDateDay"/>
+<link id="DecodeDateMonthWeek"/>
+</seealso>
+<example file="datutex/ex79"/>
 </element>
 
 <!-- argument Visibility: default -->
@@ -3802,6 +4075,28 @@ will always be an integer value, even though a double is returned.
 <!-- function Visibility: default -->
 <element name="TryEncodeDateTime">
 <short>Encode a Year, Month, Day, Hour, minute, seconds, milliseconds tuplet to a <var>TDateTime</var> value</short>
+<descr>
+<p>
+<var>EncodeDateTime</var> encodes the values <var>AYear</var>
+<var>AMonth</var>, <var>ADay</var>,<var>AHour</var>,
+<var>AMinute</var>,<var>ASecond</var> and <var>AMilliSecond</var>
+to a date/time valueand returns this value in <var>AValue</var>.
+</p>
+<p>
+If the date was encoded succesfully, <var>True</var> is returned,
+<var>False</var> is returned if one of the arguments is not valid.
+</p>
+</descr>
+<seealso>
+<link id="EncodeDateTime"/>
+<link id="EncodeDateMonthWeek"/>
+<link id="EncodeDateWeek"/>
+<link id="EncodeDateDay"/>
+<link id="TryEncodeDateDay"/>
+<link id="TryEncodeDateWeek"/>
+<link id="TryEncodeDateMonthWeek"/>
+</seealso>
+<example file="datutex/ex80"/>
 </element>
 
 <!-- function result Visibility: default -->
@@ -3852,6 +4147,28 @@ will always be an integer value, even though a double is returned.
 <!-- function Visibility: default -->
 <element name="EncodeDateWeek">
 <short>Encode a <var>TDateTime</var> value from a year, week and day of week triplet</short>
+<descr>
+<p>
+<var>EncodeDateWeek</var> encodes the values <var>AYear</var>, <var>AWeekOfYear</var>
+and <var>ADayOfWeek</var> to a date value and returns this value.
+</p>
+<p>
+For an example, see <link id="DecodeDateWeek"/>.
+</p>
+</descr>
+<errors>
+If any of the arguments is not valid, then an <var>EConvertError</var>
+exception is raised.
+</errors>
+<seealso>
+<link id="EncodeDateMonthWeek"/>
+<link id="DecodeDateWeek"/>
+<link id="EncodeDateTime"/>
+<link id="EncodeDateDay"/>
+<link id="TryEncodeDateTime"/>
+<link id="TryEncodeDateWeek"/>
+<link id="TryEncodeDateMonthWeek"/>
+</seealso>
 </element>
 
 <!-- function result Visibility: default -->
@@ -3872,6 +4189,21 @@ will always be an integer value, even though a double is returned.
 <!-- procedure Visibility: default -->
 <element name="DecodeDateWeek">
 <short>Decode a DateTime value in a week of year and day of week.</short>
+<descr>
+<var>DecodeDateWeek</var> decomposes the date indication in
+<var>AValue</var> and returns the various components in <var>AYear</var>,
+<var>AWeekOfYear</var>, <var>ADayOfWeek</var>.
+</descr>
+<seealso>
+<link id="EncodeDateTime"/>
+<link id="EncodeDateMonthWeek"/>
+<link id="EncodeDateWeek"/>
+<link id="EncodeDateDay"/>
+<link id="DecodeDateTime"/>
+<link id="DecodeDateDay"/>
+<link id="DecodeDateMonthWeek"/>
+</seealso>
+<example file="datutex/ex81"/>
 </element>
 
 <!-- argument Visibility: default -->
@@ -3897,6 +4229,27 @@ will always be an integer value, even though a double is returned.
 <!-- function Visibility: default -->
 <element name="TryEncodeDateWeek">
 <short>Encode a year, week and day of week triplet to a <var>TDateTime</var> value</short>
+<descr>
+<p>
+<var>TryEncodeDateWeek</var> encodes the values <var>AYear</var>, <var>AWeekOfYear</var>
+and <var>ADayOfWeek</var> to a date value and returns this value in
+<var>AValue</var>.
+</p>
+<p>
+If the encoding was succcesful, <var>True</var> is returned.
+<var>False</var> is returned if any of the arguments is not valid.
+</p>
+</descr>
+<seealso>
+<link id="EncodeDateMonthWeek"/>
+<link id="EncodeDateWeek"/>
+<link id="EncodeDateTime"/>
+<link id="EncodeDateDay"/>
+<link id="TryEncodeDateTime"/>
+<link id="TryEncodeDateMonthWeek"/>
+<link id="TryEncodeDateDay"/>
+</seealso>
+<example file="datutex/ex82"/>
 </element>
 
 <!-- function result Visibility: default -->
@@ -3927,6 +4280,28 @@ will always be an integer value, even though a double is returned.
 <!-- function Visibility: default -->
 <element name="EncodeDateDay">
 <short>Encodes a year and day of year to a DateTime value</short>
+<descr>
+<p>
+<var>EncodeDateDay</var> encodes the values <var>AYear</var> and <var>ADayOfYear</var>
+to a date value and returns this value.
+</p>
+<p>
+For an example, see <link id="DecodeDateDay"/>.
+</p>
+</descr>
+<errors>
+If any of the arguments is not valid, then an <var>EConvertError</var>
+exception is raised.
+</errors>
+<seealso>
+<link id="EncodeDateMonthWeek"/>
+<link id="DecodeDateDay"/>
+<link id="EncodeDateTime"/>
+<link id="EncodeDateWeek"/>
+<link id="TryEncodeDateTime"/>
+<link id="TryEncodeDateMonthWeek"/>
+<link id="TryEncodeDateWeek"/>
+</seealso>
 </element>
 
 <!-- function result Visibility: default -->
@@ -3947,6 +4322,21 @@ will always be an integer value, even though a double is returned.
 <!-- procedure Visibility: default -->
 <element name="DecodeDateDay">
 <short>Decode a DateTime value in year and year of day.</short>
+<descr>
+<var>DecodeDateDay</var> decomposes the date indication in
+<var>AValue</var> and returns the various components in <var>AYear</var>,
+<var>ADayOfYear</var>.
+</descr>
+<seealso>
+<link id="EncodeDateTime"/>
+<link id="EncodeDateMonthWeek"/>
+<link id="EncodeDateWeek"/>
+<link id="EncodeDateDay"/>
+<link id="DecodeDateTime"/>
+<link id="DecodeDateWeek"/>
+<link id="DecodeDateMonthWeek"/>
+</seealso>
+<example file="datutex/ex83"/>
 </element>
 
 <!-- argument Visibility: default -->
@@ -3967,6 +4357,27 @@ will always be an integer value, even though a double is returned.
 <!-- function Visibility: default -->
 <element name="TryEncodeDateDay">
 <short>Encode a year and day of year to a <var>TDateTime</var> value</short>
+<descr>
+<p>
+<var>TryEncodeDateDay</var> encodes the values <var>AYear</var>
+and <var>ADayOfYear</var> to a date value and returns this value in
+<var>AValue</var>.
+</p>
+<p>
+If the encoding was succcesful, <var>True</var> is returned.
+<var>False</var> is returned if any of the arguments is not valid.
+</p>
+</descr>
+<seealso>
+<link id="EncodeDateDay"/>
+<link id="EncodeDateTime"/>
+<link id="EncodeDateMonthWeek"/>
+<link id="EncodeDateWeek"/>
+<link id="TryEncodeDateTime"/>
+<link id="TryEncodeDateMonthWeek"/>
+<link id="TryEncodeDateWeek"/>
+</seealso>
+<example file="datutex/ex84"/>
 </element>
 
 <!-- function result Visibility: default -->
@@ -3992,6 +4403,30 @@ will always be an integer value, even though a double is returned.
 <!-- function Visibility: default -->
 <element name="EncodeDateMonthWeek">
 <short>Encodes a year, month, week of month and day of week to a DateTime value</short>
+<descr>
+<p>
+<var>EncodeDateTime</var> encodes the values <var>AYear</var>
+<var>AMonth</var>, <var>WeekOfMonth</var>,<var>ADayOfWeek</var>,
+to a date value and returns this value.
+</p>
+<p>
+For an example, see <link id="DecodeDateMonthWeek"/>.
+</p>
+</descr>
+<errors>
+If any of the arguments is not valid, then an <var>EConvertError</var>
+exception is raised.
+</errors>
+<seealso>
+<link id="DecodeDateMonthWeek"/>
+<link id="EncodeDateTime"/>
+<link id="EncodeDateWeek"/>
+<link id="EncodeDateDay"/>
+<link id="TryEncodeDateTime"/>
+<link id="TryEncodeDateWeek"/>
+<link id="TryEncodeDateMonthWeek"/>
+<link id="TryEncodeDateDay"/>
+</seealso>
 </element>
 
 <!-- function result Visibility: default -->
@@ -4022,6 +4457,21 @@ will always be an integer value, even though a double is returned.
 <!-- procedure Visibility: default -->
 <element name="DecodeDateMonthWeek">
 <short>Decode a DateTime value in a month, week of month and day of week</short>
+<descr>
+<var>DecodeDateMonthWeek</var> decomposes the date indication in
+<var>AValue</var> and returns the various components in <var>AYear</var>,
+<var>AMonth</var> <var>AWeekOfMonth</var> and <var>ADayOfWeek</var>.
+</descr>
+<seealso>
+<link id="EncodeDateTime"/>
+<link id="EncodeDateMonthWeek"/>
+<link id="EncodeDateWeek"/>
+<link id="EncodeDateDay"/>
+<link id="DecodeDateTime"/>
+<link id="DecodeDateWeek"/>
+<link id="DecodeDateDay"/>
+</seealso>
+<example file="datutex/ex85"/>
 </element>
 
 <!-- argument Visibility: default -->
@@ -4052,6 +4502,28 @@ will always be an integer value, even though a double is returned.
 <!-- function Visibility: default -->
 <element name="TryEncodeDateMonthWeek">
 <short>Encode a year, month, week of month and day of week to a <var>TDateTime</var> value</short>
+<descr>
+<p>
+<var>TryEncodeDateTime</var> encodes the values <var>AYear</var>
+<var>AMonth</var>, <var>WeekOfMonth</var>,<var>ADayOfWeek</var>,
+to a date value and returns this value in <var>AValue</var>.
+</p>
+<p>
+If the encoding was succesful, <var>True</var> is returned, <var>False</var>
+if any of the arguments is not valid.
+</p>
+</descr>
+<seealso>
+<link id="DecodeDateMonthWeek"/>
+<link id="EncodeDateTime"/>
+<link id="EncodeDateWeek"/>
+<link id="EncodeDateDay"/>
+<link id="EncodeDateMonthWeek"/>
+<link id="TryEncodeDateTime"/>
+<link id="TryEncodeDateWeek"/>
+<link id="TryEncodeDateDay"/>
+</seealso>
+<example file="datutex/ex86"/>
 </element>
 
 <!-- function result Visibility: default -->

+ 16 - 0
docs/datutex/README

@@ -59,3 +59,19 @@ ex59.pp contains an example of the HoursBetween function.
 ex60.pp contains an example of the MinutesBetween function.
 ex61.pp contains an example of the SecondsBetween function.
 ex62.pp contains an example of the MilliSecondsBetween function.
+ex71.pp contains an example of the IncYear function.
+ex72.pp contains an example of the IncMonth function.
+ex73.pp contains an example of the IncWeek function.
+ex74.pp contains an example of the IncDay function.
+ex75.pp contains an example of the IncHour function.
+ex76.pp contains an example of the IncMinute function.
+ex77.pp contains an example of the IncSecond function.
+ex78.pp contains an example of the IncMilliSecond function.
+ex79.pp contains an example of the DecodeDateTime and EncodeDateTime functions.
+ex80.pp contains an example of the TryEncodeDateTime function.
+ex81.pp contains an example of the DecodeDateWeek and EncodeDateWeek functions.
+ex82.pp contains an example of the TryEncodeDateWeek function.
+ex83.pp contains an example of the DecodeDateDay and EncodeDateDay functions.
+ex84.pp contains an example of the TryEncodeDateDay function.
+ex85.pp contains an example of the DecodeDateMonthWeek and EncodeDateMonthWeek functions.
+ex86.pp contains an example of the TryEncodeDateMonthWeek function.

+ 1 - 1
docs/datutex/ex38.pp

@@ -1,4 +1,4 @@
-Program Example36;
+Program Example38;
 
 { This program demonstrates the StartOfADay function }
 

+ 1 - 1
docs/datutex/ex39.pp

@@ -1,4 +1,4 @@
-Program Example36;
+Program Example39;
 
 { This program demonstrates the EndOfADay function }
 

+ 1 - 1
docs/datutex/ex45.pp

@@ -1,4 +1,4 @@
-Program Example44;
+Program Example45;
 
 { This program demonstrates the SecondOfTheMinute function }
 

+ 1 - 1
docs/datutex/ex46.pp

@@ -1,4 +1,4 @@
-Program Example44;
+Program Example46;
 
 { This program demonstrates the MilliSecondOfTheSecond function }
 

+ 1 - 1
docs/datutex/ex56.pp

@@ -1,6 +1,6 @@
 Program Example56;
 
-{ This program demonstrates the WithinPastMonths function }
+{ This program demonstrates the MonthsBetween function }
 
 Uses SysUtils,DateUtils;
 

+ 32 - 0
docs/datutex/ex63.pp

@@ -0,0 +1,32 @@
+Program Example63;
+
+{ This program demonstrates the YearSpan function }
+
+Uses SysUtils,DateUtils;
+
+Procedure Test(ANow,AThen : TDateTime);
+
+begin
+ Write('Number of years between ');
+ Write(DateToStr(AThen),' and ',DateToStr(ANow));
+ Writeln(' : ',YearSpan(ANow,AThen));
+end;
+
+Var
+  D1,D2 : TDateTime;
+
+Begin
+  D1:=Today;
+  D2:=Today-364;
+  Test(D1,D2);
+  D2:=Today-365;
+  Test(D1,D2);
+  D2:=Today-366;
+  Test(D1,D2);
+  D2:=Today-390;
+  Test(D1,D2);
+  D2:=Today-368;
+  Test(D1,D2);
+  D2:=Today-1000;
+  Test(D1,D2);
+End.

+ 32 - 0
docs/datutex/ex64.pp

@@ -0,0 +1,32 @@
+Program Example64;
+
+{ This program demonstrates the MonthSpan function }
+
+Uses SysUtils,DateUtils;
+
+Procedure Test(ANow,AThen : TDateTime);
+
+begin
+ Write('Number of months between ');
+ Write(DateToStr(AThen),' and ',DateToStr(ANow));
+ Writeln(' : ',MonthSpan(ANow,AThen));
+end;
+
+Var
+  D1,D2 : TDateTime;
+
+Begin
+  D1:=Today;
+  D2:=Today-364;
+  Test(D1,D2);
+  D2:=Today-365;
+  Test(D1,D2);
+  D2:=Today-366;
+  Test(D1,D2);
+  D2:=Today-390;
+  Test(D1,D2);
+  D2:=Today-368;
+  Test(D1,D2);
+  D2:=Today-1000;
+  Test(D1,D2);
+End.

+ 32 - 0
docs/datutex/ex65.pp

@@ -0,0 +1,32 @@
+Program Example57;
+
+{ This program demonstrates the WeekSpan function }
+
+Uses SysUtils,DateUtils;
+
+Procedure Test(ANow,AThen : TDateTime);
+
+begin
+ Write('Number of weeks between ');
+ Write(DateToStr(AThen),' and ',DateToStr(ANow));
+ Writeln(' : ',WeekSpan(ANow,AThen));
+end;
+
+Var
+  D1,D2 : TDateTime;
+
+Begin
+  D1:=Today;
+  D2:=Today-7;
+  Test(D1,D2);
+  D2:=Today-8;
+  Test(D1,D2);
+  D2:=Today-14;
+  Test(D1,D2);
+  D2:=Today-35;
+  Test(D1,D2);
+  D2:=Today-36;
+  Test(D1,D2);
+  D2:=Today-17;
+  Test(D1,D2);
+End.

+ 32 - 0
docs/datutex/ex66.pp

@@ -0,0 +1,32 @@
+Program Example66;
+
+{ This program demonstrates the DaySpan function }
+
+Uses SysUtils,DateUtils;
+
+Procedure Test(ANow,AThen : TDateTime);
+
+begin
+ Write('Number of days between ');
+ Write(DateTimeToStr(AThen),' and ',DateTimeToStr(ANow));
+ Writeln(' : ',DaySpan(ANow,AThen));
+end;
+
+Var
+  D1,D2 : TDateTime;
+
+Begin
+  D1:=Now;
+  D2:=Today-23/24;
+  Test(D1,D2);
+  D2:=Today-1;
+  Test(D1,D2);
+  D2:=Today-25/24;
+  Test(D1,D2);
+  D2:=Today-26/24;
+  Test(D1,D2);
+  D2:=Today-5.4;
+  Test(D1,D2);
+  D2:=Today-2.5;
+  Test(D1,D2);
+End.

+ 32 - 0
docs/datutex/ex67.pp

@@ -0,0 +1,32 @@
+Program Example67;
+
+{ This program demonstrates the HourSpan function }
+
+Uses SysUtils,DateUtils;
+
+Procedure Test(ANow,AThen : TDateTime);
+
+begin
+ Write('Number of hours between ');
+ Write(DateTimeToStr(AThen),' and ',DateTimeToStr(ANow));
+ Writeln(' : ',HourSpan(ANow,AThen));
+end;
+
+Var
+  D1,D2 : TDateTime;
+
+Begin
+  D1:=Now;
+  D2:=D1-(59*OneMinute);
+  Test(D1,D2);
+  D2:=D1-(61*OneMinute);
+  Test(D1,D2);
+  D2:=D1-(122*OneMinute);
+  Test(D1,D2);
+  D2:=D1-(306*OneMinute);
+  Test(D1,D2);
+  D2:=D1-(5.4*OneHour);
+  Test(D1,D2);
+  D2:=D1-(2.5*OneHour);
+  Test(D1,D2);
+End.

+ 32 - 0
docs/datutex/ex68.pp

@@ -0,0 +1,32 @@
+Program Example68;
+
+{ This program demonstrates the MinuteSpan function }
+
+Uses SysUtils,DateUtils;
+
+Procedure Test(ANow,AThen : TDateTime);
+
+begin
+ Write('Number of minutes between ');
+ Write(TimeToStr(AThen),' and ',TimeToStr(ANow));
+ Writeln(' : ',MinuteSpan(ANow,AThen));
+end;
+
+Var
+  D1,D2 : TDateTime;
+
+Begin
+  D1:=Now;
+  D2:=D1-(59*OneSecond);
+  Test(D1,D2);
+  D2:=D1-(61*OneSecond);
+  Test(D1,D2);
+  D2:=D1-(122*OneSecond);
+  Test(D1,D2);
+  D2:=D1-(306*OneSecond);
+  Test(D1,D2);
+  D2:=D1-(5.4*OneMinute);
+  Test(D1,D2);
+  D2:=D1-(2.5*OneMinute);
+  Test(D1,D2);
+End.

+ 32 - 0
docs/datutex/ex69.pp

@@ -0,0 +1,32 @@
+Program Example69;
+
+{ This program demonstrates the SecondSpan function }
+
+Uses SysUtils,DateUtils;
+
+Procedure Test(ANow,AThen : TDateTime);
+
+begin
+ Write('Number of seconds between ');
+ Write(TimeToStr(AThen),' and ',TimeToStr(ANow));
+ Writeln(' : ',SecondSpan(ANow,AThen));
+end;
+
+Var
+  D1,D2 : TDateTime;
+
+Begin
+  D1:=Now;
+  D2:=D1-(999*OneMilliSecond);
+  Test(D1,D2);
+  D2:=D1-(1001*OneMilliSecond);
+  Test(D1,D2);
+  D2:=D1-(2001*OneMilliSecond);
+  Test(D1,D2);
+  D2:=D1-(5001*OneMilliSecond);
+  Test(D1,D2);
+  D2:=D1-(5.4*OneSecond);
+  Test(D1,D2);
+  D2:=D1-(2.5*OneSecond);
+  Test(D1,D2);
+End.

+ 28 - 0
docs/datutex/ex70.pp

@@ -0,0 +1,28 @@
+Program Example70;
+
+{ This program demonstrates the MilliSecondSpan function }
+
+Uses SysUtils,DateUtils;
+
+Procedure Test(ANow,AThen : TDateTime);
+
+begin
+ Write('Number of milliseconds between ');
+ Write(TimeToStr(AThen),' and ',TimeToStr(ANow));
+ Writeln(' : ',MilliSecondSpan(ANow,AThen));
+end;
+
+Var
+  D1,D2 : TDateTime;
+
+Begin
+  D1:=Now;
+  D2:=D1-(0.9*OneMilliSecond);
+  Test(D1,D2);
+  D2:=D1-(1.0*OneMilliSecond);
+  Test(D1,D2);
+  D2:=D1-(1.1*OneMilliSecond);
+  Test(D1,D2);
+  D2:=D1-(2.5*OneMilliSecond);
+  Test(D1,D2);
+End.

+ 10 - 0
docs/datutex/ex71.pp

@@ -0,0 +1,10 @@
+Program Example71;
+
+{ This program demonstrates the IncYear function }
+
+Uses SysUtils,DateUtils;
+
+Begin
+  Writeln('One year from today is ',DateToStr(IncYear(Today,1)));
+  Writeln('One year ago from today is ',DateToStr(IncYear(Today,-1)));
+End.

+ 10 - 0
docs/datutex/ex72.pp

@@ -0,0 +1,10 @@
+Program Example72;
+
+{ This program demonstrates the IncMonth function }
+
+Uses SysUtils,DateUtils;
+
+Begin
+  Writeln('One Month from today is ',DateToStr(IncMonth(Today,1)));
+  Writeln('One Month ago from today is ',DateToStr(IncMonth(Today,-1)));
+End.

+ 10 - 0
docs/datutex/ex73.pp

@@ -0,0 +1,10 @@
+Program Example73;
+
+{ This program demonstrates the IncWeek function }
+
+Uses SysUtils,DateUtils;
+
+Begin
+  Writeln('One Week from today is ',DateToStr(IncWeek(Today,1)));
+  Writeln('One Week ago from today is ',DateToStr(IncWeek(Today,-1)));
+End.

+ 10 - 0
docs/datutex/ex74.pp

@@ -0,0 +1,10 @@
+Program Example74;
+
+{ This program demonstrates the IncDay function }
+
+Uses SysUtils,DateUtils;
+
+Begin
+  Writeln('One Day from today is ',DateToStr(IncDay(Today,1)));
+  Writeln('One Day ago from today is ',DateToStr(IncDay(Today,-1)));
+End.

+ 11 - 0
docs/datutex/ex75.pp

@@ -0,0 +1,11 @@
+Program Example75
+;
+
+{ This program demonstrates the IncHour function }
+
+Uses SysUtils,DateUtils;
+
+Begin
+  Writeln('One Hour from now is ',DateTimeToStr(IncHour(Now,1)));
+  Writeln('One Hour ago from now is ',DateTimeToStr(IncHour(Now,-1)));
+End.

+ 10 - 0
docs/datutex/ex76.pp

@@ -0,0 +1,10 @@
+Program Example76;
+
+{ This program demonstrates the IncMinute function }
+
+Uses SysUtils,DateUtils;
+
+Begin
+  Writeln('One Minute from now is ',TimeToStr(IncMinute(Time,1)));
+  Writeln('One Minute ago from now is ',TimeToStr(IncMinute(Time,-1)));
+End.

+ 10 - 0
docs/datutex/ex77.pp

@@ -0,0 +1,10 @@
+Program Example77;
+
+{ This program demonstrates the IncSecond function }
+
+Uses SysUtils,DateUtils;
+
+Begin
+  Writeln('One Second from now is ',TimeToStr(IncSecond(Time,1)));
+  Writeln('One Second ago from now is ',TimeToStr(IncSecond(Time,-1)));
+End.

+ 10 - 0
docs/datutex/ex78.pp

@@ -0,0 +1,10 @@
+Program Example78;
+
+{ This program demonstrates the IncMilliSecond function }
+
+Uses SysUtils,DateUtils;
+
+Begin
+  Writeln('One MilliSecond from now is ',TimeToStr(IncMilliSecond(Now,1)));
+  Writeln('One MilliSecond ago from now is ',TimeToStr(IncMilliSecond(Now,-1)));
+End.

+ 15 - 0
docs/datutex/ex79.pp

@@ -0,0 +1,15 @@
+Program Example79;
+
+{ This program demonstrates the DecodeDateTime function }
+
+Uses SysUtils,DateUtils;
+
+Var
+  Y,Mo,D,H,Mi,S,MS : Word;
+  TS : TDateTime;
+  
+Begin
+  DecodeDateTime(Now,Y,Mo,D,H,Mi,S,MS);
+  TS:=EncodeDateTime(Y,Mo,D,H,Mi,S,MS);
+  Writeln('Now is : ',DateTimeToStr(TS));
+End.

+ 17 - 0
docs/datutex/ex80.pp

@@ -0,0 +1,17 @@
+Program Example79;
+
+{ This program demonstrates the TryEncodeDateTime function }
+
+Uses SysUtils,DateUtils;
+
+Var
+  Y,Mo,D,H,Mi,S,MS : Word;
+  TS : TDateTime;
+  
+Begin
+  DecodeDateTime(Now,Y,Mo,D,H,Mi,S,MS);
+  If TryEncodeDateTime(Y,Mo,D,H,Mi,S,MS,TS) then
+    Writeln('Now is : ',DateTimeToStr(TS))
+  else
+    Writeln('Wrong date/time indication');
+End.

+ 15 - 0
docs/datutex/ex81.pp

@@ -0,0 +1,15 @@
+Program Example81;
+
+{ This program demonstrates the DecodeDateWeek function }
+
+Uses SysUtils,DateUtils;
+
+Var
+  Y,W,Dow : Word;
+  TS : TDateTime;
+  
+Begin
+  DecodeDateWeek(Now,Y,W,Dow);
+  TS:=EncodeDateWeek(Y,W,Dow);
+  Writeln('Today is : ',DateToStr(TS));
+End.

+ 17 - 0
docs/datutex/ex82.pp

@@ -0,0 +1,17 @@
+Program Example82;
+
+{ This program demonstrates the TryEncodeDateWeek function }
+
+Uses SysUtils,DateUtils;
+
+Var
+  Y,W,Dow : Word;
+  TS : TDateTime;
+  
+Begin
+  DecodeDateWeek(Now,Y,W,Dow);
+  If TryEncodeDateWeek(Y,W,TS,Dow) then
+    Writeln('Today is : ',DateToStr(TS))
+  else
+    Writeln('Invalid date/week indication');
+End.

+ 15 - 0
docs/datutex/ex83.pp

@@ -0,0 +1,15 @@
+Program Example83;
+
+{ This program demonstrates the DecodeDateDay function }
+
+Uses SysUtils,DateUtils;
+
+Var
+  Y,DoY : Word;
+  TS : TDateTime;
+  
+Begin
+  DecodeDateDay(Now,Y,DoY);
+  TS:=EncodeDateDay(Y,DoY);
+  Writeln('Today is : ',DateToStr(TS));
+End.

+ 17 - 0
docs/datutex/ex84.pp

@@ -0,0 +1,17 @@
+Program Example84;
+
+{ This program demonstrates the TryEncodeDateDay function }
+
+Uses SysUtils,DateUtils;
+
+Var
+  Y,DoY : Word;
+  TS : TDateTime;
+  
+Begin
+  DecodeDateDay(Now,Y,DoY);
+  If TryEncodeDateDay(Y,DoY,TS) then
+    Writeln('Today is : ',DateToStr(TS))
+  else
+    Writeln('Wrong year/day of year indication');  
+End.

+ 15 - 0
docs/datutex/ex85.pp

@@ -0,0 +1,15 @@
+Program Example85;
+
+{ This program demonstrates the DecodeDateMonthWeek function }
+
+Uses SysUtils,DateUtils;
+
+Var
+  Y,M,Wom,Dow : Word;
+  TS : TDateTime;
+  
+Begin
+  DecodeDateMonthWeek(Now,Y,M,WoM,DoW);
+  TS:=EncodeDateMonthWeek(Y,M,WoM,Dow);
+  Writeln('Today is : ',DateToStr(TS));
+End.

+ 17 - 0
docs/datutex/ex86.pp

@@ -0,0 +1,17 @@
+Program Example86;
+
+{ This program demonstrates the TryEncodeDateMonthWeek function }
+
+Uses SysUtils,DateUtils;
+
+Var
+  Y,M,Wom,Dow : Word;
+  TS : TDateTime;
+  
+Begin
+  DecodeDateMonthWeek(Now,Y,M,WoM,DoW);
+  If TryEncodeDateMonthWeek(Y,M,WoM,Dow,TS) then
+    Writeln('Today is : ',DateToStr(TS))
+  else
+    Writeln('Invalid year/month/week/dow indication');  
+End.