mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-26 10:49:11 +02:00
+ Last but one batch of examples
This commit is contained in:
parent
81ed80915f
commit
4fe57715f0
@ -4426,6 +4426,7 @@ exception is raised.
|
||||
<link id="TryEncodeDateWeek"/>
|
||||
<link id="TryEncodeDateMonthWeek"/>
|
||||
<link id="TryEncodeDateDay"/>
|
||||
<link id="NthDayOfWeek"/>
|
||||
</seealso>
|
||||
</element>
|
||||
|
||||
@ -4522,6 +4523,7 @@ if any of the arguments is not valid.
|
||||
<link id="TryEncodeDateTime"/>
|
||||
<link id="TryEncodeDateWeek"/>
|
||||
<link id="TryEncodeDateDay"/>
|
||||
<link id="NthDayOfWeek"/>
|
||||
</seealso>
|
||||
<example file="datutex/ex86"/>
|
||||
</element>
|
||||
@ -4559,6 +4561,26 @@ if any of the arguments is not valid.
|
||||
<!-- function Visibility: default -->
|
||||
<element name="RecodeYear">
|
||||
<short>Replace year part of a <var>TDateTime</var> value with another year.</short>
|
||||
<descr>
|
||||
<var>RecodeYear</var> replaces the year part of the timestamp <var>AValue</var>
|
||||
with <var>AYear</var>. All other parts of the date/time stamp are left untouched.
|
||||
</descr>
|
||||
<errors>
|
||||
If the <var>AYear</var> value is not within a valid range (1..9999) then
|
||||
an <var>EConvertError</var> exception is raised.
|
||||
</errors>
|
||||
<seealso>
|
||||
<link id="RecodeMonth"/>
|
||||
<link id="RecodeDay"/>
|
||||
<link id="RecodeHour"/>
|
||||
<link id="RecodeMinute"/>
|
||||
<link id="RecodeSecond"/>
|
||||
<link id="RecodeMilliSecond"/>
|
||||
<link id="RecodeDate"/>
|
||||
<link id="RecodeTime"/>
|
||||
<link id="RecodeDateTime"/>
|
||||
</seealso>
|
||||
<example file="datutex/ex87"/>
|
||||
</element>
|
||||
|
||||
<!-- function result Visibility: default -->
|
||||
@ -4579,6 +4601,26 @@ if any of the arguments is not valid.
|
||||
<!-- function Visibility: default -->
|
||||
<element name="RecodeMonth">
|
||||
<short>Replace month part of a <var>TDateTime</var> value with another month.</short>
|
||||
<descr>
|
||||
<var>RecodeMonth</var> replaces the Month part of the timestamp <var>AValue</var>
|
||||
with <var>AMonth</var>. All other parts of the date/time stamp are left untouched.
|
||||
</descr>
|
||||
<errors>
|
||||
If the <var>AMonth</var> value is not within a valid range (1..12) then
|
||||
an <var>EConvertError</var> exception is raised.
|
||||
</errors>
|
||||
<seealso>
|
||||
<link id="RecodeYear"/>
|
||||
<link id="RecodeDay"/>
|
||||
<link id="RecodeHour"/>
|
||||
<link id="RecodeMinute"/>
|
||||
<link id="RecodeSecond"/>
|
||||
<link id="RecodeMilliSecond"/>
|
||||
<link id="RecodeDate"/>
|
||||
<link id="RecodeTime"/>
|
||||
<link id="RecodeDateTime"/>
|
||||
</seealso>
|
||||
<example file="datutex/ex88"/>
|
||||
</element>
|
||||
|
||||
<!-- function result Visibility: default -->
|
||||
@ -4599,6 +4641,26 @@ if any of the arguments is not valid.
|
||||
<!-- function Visibility: default -->
|
||||
<element name="RecodeDay">
|
||||
<short>Replace day part of a <var>TDateTime</var> value with another day.</short>
|
||||
<descr>
|
||||
<var>RecodeDay</var> replaces the Day part of the timestamp <var>AValue</var>
|
||||
with <var>ADay</var>. All other parts of the date/time stamp are left untouched.
|
||||
</descr>
|
||||
<errors>
|
||||
If the <var>ADay</var> value is not within a valid range (1..12) then
|
||||
an <var>EConvertError</var> exception is raised.
|
||||
</errors>
|
||||
<seealso>
|
||||
<link id="RecodeYear"/>
|
||||
<link id="RecodeMonth"/>
|
||||
<link id="RecodeHour"/>
|
||||
<link id="RecodeMinute"/>
|
||||
<link id="RecodeSecond"/>
|
||||
<link id="RecodeMilliSecond"/>
|
||||
<link id="RecodeDate"/>
|
||||
<link id="RecodeTime"/>
|
||||
<link id="RecodeDateTime"/>
|
||||
</seealso>
|
||||
<example file="datutex/ex89"/>
|
||||
</element>
|
||||
|
||||
<!-- function result Visibility: default -->
|
||||
@ -4619,6 +4681,26 @@ if any of the arguments is not valid.
|
||||
<!-- function Visibility: default -->
|
||||
<element name="RecodeHour">
|
||||
<short>Replace hours part of a <var>TDateTime</var> value with another hour.</short>
|
||||
<descr>
|
||||
<var>RecodeHour</var> replaces the Hour part of the timestamp <var>AValue</var>
|
||||
with <var>AHour</var>. All other parts of the date/time stamp are left untouched.
|
||||
</descr>
|
||||
<errors>
|
||||
If the <var>AHour</var> value is not within a valid range (0..23) then
|
||||
an <var>EConvertError</var> exception is raised.
|
||||
</errors>
|
||||
<seealso>
|
||||
<link id="RecodeYear"/>
|
||||
<link id="RecodeMonth"/>
|
||||
<link id="RecodeDay"/>
|
||||
<link id="RecodeMinute"/>
|
||||
<link id="RecodeSecond"/>
|
||||
<link id="RecodeMilliSecond"/>
|
||||
<link id="RecodeDate"/>
|
||||
<link id="RecodeTime"/>
|
||||
<link id="RecodeDateTime"/>
|
||||
</seealso>
|
||||
<example file="datutex/ex90"/>
|
||||
</element>
|
||||
|
||||
<!-- function result Visibility: default -->
|
||||
@ -4639,6 +4721,26 @@ if any of the arguments is not valid.
|
||||
<!-- function Visibility: default -->
|
||||
<element name="RecodeMinute">
|
||||
<short>Replace minutse part of a <var>TDateTime</var> value with another minute.</short>
|
||||
<descr>
|
||||
<var>RecodeMinute</var> replaces the Minute part of the timestamp <var>AValue</var>
|
||||
with <var>AMinute</var>. All other parts of the date/time stamp are left untouched.
|
||||
</descr>
|
||||
<errors>
|
||||
If the <var>AMinute</var> value is not within a valid range (0..59) then
|
||||
an <var>EConvertError</var> exception is raised.
|
||||
</errors>
|
||||
<seealso>
|
||||
<link id="RecodeYear"/>
|
||||
<link id="RecodeMonth"/>
|
||||
<link id="RecodeDay"/>
|
||||
<link id="RecodeHour"/>
|
||||
<link id="RecodeSecond"/>
|
||||
<link id="RecodeMilliSecond"/>
|
||||
<link id="RecodeDate"/>
|
||||
<link id="RecodeTime"/>
|
||||
<link id="RecodeDateTime"/>
|
||||
</seealso>
|
||||
<example file="datutex/ex91"/>
|
||||
</element>
|
||||
|
||||
<!-- function result Visibility: default -->
|
||||
@ -4659,6 +4761,26 @@ if any of the arguments is not valid.
|
||||
<!-- function Visibility: default -->
|
||||
<element name="RecodeSecond">
|
||||
<short>Replace seconds part of a <var>TDateTime</var> value with another second.</short>
|
||||
<descr>
|
||||
<var>RecodeSecond</var> replaces the Second part of the timestamp <var>AValue</var>
|
||||
with <var>ASecond</var>. All other parts of the date/time stamp are left untouched.
|
||||
</descr>
|
||||
<errors>
|
||||
If the <var>ASecond</var> value is not within a valid range (0..59) then
|
||||
an <var>EConvertError</var> exception is raised.
|
||||
</errors>
|
||||
<seealso>
|
||||
<link id="RecodeYear"/>
|
||||
<link id="RecodeMonth"/>
|
||||
<link id="RecodeDay"/>
|
||||
<link id="RecodeHour"/>
|
||||
<link id="RecodeMinute"/>
|
||||
<link id="RecodeMilliSecond"/>
|
||||
<link id="RecodeDate"/>
|
||||
<link id="RecodeTime"/>
|
||||
<link id="RecodeDateTime"/>
|
||||
</seealso>
|
||||
<example file="datutex/ex92"/>
|
||||
</element>
|
||||
|
||||
<!-- function result Visibility: default -->
|
||||
@ -4679,6 +4801,26 @@ if any of the arguments is not valid.
|
||||
<!-- function Visibility: default -->
|
||||
<element name="RecodeMilliSecond">
|
||||
<short>Replace milliseconds part of a <var>TDateTime</var> value with another millisecond.</short>
|
||||
<descr>
|
||||
<var>RecodeMilliSecond</var> replaces the millisecond part of the timestamp <var>AValue</var>
|
||||
with <var>AMilliSecond</var>. All other parts of the date/time stamp are left untouched.
|
||||
</descr>
|
||||
<errors>
|
||||
If the <var>AMilliSecond</var> value is not within a valid range (0..999) then
|
||||
an <var>EConvertError</var> exception is raised.
|
||||
</errors>
|
||||
<seealso>
|
||||
<link id="RecodeYear"/>
|
||||
<link id="RecodeMonth"/>
|
||||
<link id="RecodeDay"/>
|
||||
<link id="RecodeHour"/>
|
||||
<link id="RecodeMinute"/>
|
||||
<link id="RecodeSecond"/>
|
||||
<link id="RecodeDate"/>
|
||||
<link id="RecodeTime"/>
|
||||
<link id="RecodeDateTime"/>
|
||||
</seealso>
|
||||
<example file="datutex/ex93"/>
|
||||
</element>
|
||||
|
||||
<!-- function result Visibility: default -->
|
||||
@ -4699,6 +4841,27 @@ if any of the arguments is not valid.
|
||||
<!-- function Visibility: default -->
|
||||
<element name="RecodeDate">
|
||||
<short>Replace date part of a <var>TDateTime</var> value with another date.</short>
|
||||
<descr>
|
||||
<var>RecodeDate</var> replaces the date part of the timestamp <var>AValue</var>
|
||||
with the date specified in <var>AYear</var>, <var>AMonth</var>, <var>ADay</var>.
|
||||
All other parts (the time part) of the date/time stamp are left untouched.
|
||||
</descr>
|
||||
<errors>
|
||||
If one of the <var>AYear</var>, <var>AMonth</var>, <var>ADay</var> values is not within
|
||||
a valid range then an <var>EConvertError</var> exception is raised.
|
||||
</errors>
|
||||
<seealso>
|
||||
<link id="RecodeYear"/>
|
||||
<link id="RecodeMonth"/>
|
||||
<link id="RecodeDay"/>
|
||||
<link id="RecodeHour"/>
|
||||
<link id="RecodeMinute"/>
|
||||
<link id="RecodeSecond"/>
|
||||
<link id="RecodeDate"/>
|
||||
<link id="RecodeTime"/>
|
||||
<link id="RecodeDateTime"/>
|
||||
</seealso>
|
||||
<example file="datutex/ex94"/>
|
||||
</element>
|
||||
|
||||
<!-- function result Visibility: default -->
|
||||
@ -4729,6 +4892,29 @@ if any of the arguments is not valid.
|
||||
<!-- function Visibility: default -->
|
||||
<element name="RecodeTime">
|
||||
<short>Replace time part of a <var>TDateTime</var> value with another time.</short>
|
||||
<descr>
|
||||
<var>RecodeTime</var> replaces the time part of the timestamp <var>AValue</var>
|
||||
with the date specified in <var>AHour</var>, <var>AMinute</var>,
|
||||
<var>ASecond</var> and <var>AMilliSecond</var>.
|
||||
All other parts (the date part) of the date/time stamp are left untouched.
|
||||
</descr>
|
||||
<errors>
|
||||
If one of the values <var>AHour</var>, <var>AMinute</var>, <var>ASecond</var>
|
||||
<var>AMilliSecond</var> is not within a valid range then an <var>EConvertError</var>
|
||||
exception is raised.
|
||||
</errors>
|
||||
<seealso>
|
||||
<link id="RecodeYear"/>
|
||||
<link id="RecodeMonth"/>
|
||||
<link id="RecodeDay"/>
|
||||
<link id="RecodeHour"/>
|
||||
<link id="RecodeMinute"/>
|
||||
<link id="RecodeSecond"/>
|
||||
<link id="RecodeMilliSecond"/>
|
||||
<link id="RecodeDate"/>
|
||||
<link id="RecodeDateTime"/>
|
||||
</seealso>
|
||||
<example file="datutex/ex95"/>
|
||||
</element>
|
||||
|
||||
<!-- function result Visibility: default -->
|
||||
@ -4764,6 +4950,33 @@ if any of the arguments is not valid.
|
||||
<!-- function Visibility: default -->
|
||||
<element name="RecodeDateTime">
|
||||
<short>Replace selected parts of a <var>TDateTime</var> value with other values </short>
|
||||
<descr>
|
||||
<var>RecodeDateTime</var> replaces selected parts of the timestamp <var>AValue</var>
|
||||
with the date/time values specified in <var>AYear</var>, <var>AMonth</var>,
|
||||
<var>ADay</var>, <var>AHour</var>, <var>AMinute</var>, <var>ASecond</var> and
|
||||
<var>AMilliSecond</var>. If any of these values
|
||||
equals the pre-defined constant <link id="RecodeLeaveFieldAsIs"/>, then
|
||||
the corresponding part of the date/time stamp is left untouched.
|
||||
</descr>
|
||||
<errors>
|
||||
If one of the values <var>AYear</var>, <var>AMonth</var>,
|
||||
<var>ADay</var>, <var>AHour</var>, <var>AMinute</var>, <var>ASecond</var>
|
||||
<var>AMilliSecond</var> is not within a valid range (<var>RecodeLeaveFieldAsIs</var> excepted)
|
||||
then an <var>EConvertError</var> exception is raised.
|
||||
</errors>
|
||||
<seealso>
|
||||
<link id="RecodeYear"/>
|
||||
<link id="RecodeMonth"/>
|
||||
<link id="RecodeDay"/>
|
||||
<link id="RecodeHour"/>
|
||||
<link id="RecodeMinute"/>
|
||||
<link id="RecodeSecond"/>
|
||||
<link id="RecodeMilliSecond"/>
|
||||
<link id="RecodeDate"/>
|
||||
<link id="RecodeTime"/>
|
||||
<link id="TryRecodeDateTime"/>
|
||||
</seealso>
|
||||
<example file="datutex/ex96"/>
|
||||
</element>
|
||||
|
||||
<!-- function result Visibility: default -->
|
||||
@ -4814,6 +5027,38 @@ if any of the arguments is not valid.
|
||||
<!-- function Visibility: default -->
|
||||
<element name="TryRecodeDateTime">
|
||||
<short>Replace selected parts of a <var>TDateTime</var> value with other values</short>
|
||||
<descr>
|
||||
<p>
|
||||
<var>TryRecodeDateTime</var> replaces selected parts of the timestamp <var>AValue</var>
|
||||
with the date/time values specified in <var>AYear</var>, <var>AMonth</var>,
|
||||
<var>ADay</var>, <var>AHour</var>, <var>AMinute</var>, <var>ASecond</var> and
|
||||
<var>AMilliSecond</var>. If any of these values
|
||||
equals the pre-defined constant <link id="RecodeLeaveFieldAsIs"/>, then
|
||||
the corresponding part of the date/time stamp is left untouched.
|
||||
</p>
|
||||
<p>
|
||||
The resulting date/time is returned in <var>AValue</var>.
|
||||
</p>
|
||||
<p>
|
||||
The function returns <var>True</var> if the encoding was succesful. It
|
||||
returns <var>False</var> if one of the values <var>AYear</var>, <var>AMonth</var>,
|
||||
<var>ADay</var>, <var>AHour</var>, <var>AMinute</var>, <var>ASecond</var>
|
||||
<var>AMilliSecond</var> is not within a valid range.
|
||||
</p>
|
||||
</descr>
|
||||
<seealso>
|
||||
<link id="RecodeYear"/>
|
||||
<link id="RecodeMonth"/>
|
||||
<link id="RecodeDay"/>
|
||||
<link id="RecodeHour"/>
|
||||
<link id="RecodeMinute"/>
|
||||
<link id="RecodeSecond"/>
|
||||
<link id="RecodeMilliSecond"/>
|
||||
<link id="RecodeDate"/>
|
||||
<link id="RecodeTime"/>
|
||||
<link id="RecodeDateTime"/>
|
||||
</seealso>
|
||||
<example file="datutex/ex97"/>
|
||||
</element>
|
||||
|
||||
<!-- function result Visibility: default -->
|
||||
@ -4868,6 +5113,25 @@ if any of the arguments is not valid.
|
||||
<!-- function Visibility: default -->
|
||||
<element name="CompareDateTime">
|
||||
<short>Compare 2 dates, taking into account the time of day</short>
|
||||
<descr>
|
||||
<p>
|
||||
<var>CompareDateTime</var> compares two timestamps <var>A</var> and
|
||||
<var>B</var> and returns the following results:
|
||||
</p>
|
||||
<dl>
|
||||
<dt>< 0</dt><dd>if <var>A</var> is earlier in date/time than <var>B</var>.</dd>
|
||||
<dt>0</dt><dd>if <var>A</var> and <var>B</var> are the same date/time .</dd>
|
||||
<dt>> 0</dt><dd>if <var>A</var> is later in date/time than <var>B</var>.</dd>
|
||||
</dl>
|
||||
</descr>
|
||||
<seealso>
|
||||
<link id="CompareTime"/>
|
||||
<link id="CompareDate"/>
|
||||
<link id="SameDate"/>
|
||||
<link id="SameTime"/>
|
||||
<link id="SameDateTime"/>
|
||||
</seealso>
|
||||
<example file="datutex/ex98"/>
|
||||
</element>
|
||||
|
||||
<!-- function result Visibility: default -->
|
||||
@ -4888,6 +5152,25 @@ if any of the arguments is not valid.
|
||||
<!-- function Visibility: default -->
|
||||
<element name="CompareDate">
|
||||
<short>Compare 2 dates, disregarding the time of day</short>
|
||||
<descr>
|
||||
<p>
|
||||
<var>CompareDate</var> compares the date parts of two timestamps <var>A</var> and
|
||||
<var>B</var> and returns the following results:
|
||||
</p>
|
||||
<dl>
|
||||
<dt>< 0</dt><dd>if the day part of <var>A</var> is earlier than the day part of <var>B</var>.</dd>
|
||||
<dt>0</dt><dd>if <var>A</var> and <var>B</var> are the on same day (times may differ) .</dd>
|
||||
<dt>> 0</dt><dd>if the day part of <var>A</var> is later than the day part of <var>B</var>.</dd>
|
||||
</dl>
|
||||
</descr>
|
||||
<seealso>
|
||||
<link id="CompareTime"/>
|
||||
<link id="CompareDateTime"/>
|
||||
<link id="SameDate"/>
|
||||
<link id="SameTime"/>
|
||||
<link id="SameDateTime"/>
|
||||
</seealso>
|
||||
<example file="datutex/ex99"/>
|
||||
</element>
|
||||
|
||||
<!-- function result Visibility: default -->
|
||||
@ -4908,6 +5191,25 @@ if any of the arguments is not valid.
|
||||
<!-- function Visibility: default -->
|
||||
<element name="CompareTime">
|
||||
<short>Compares two times of the day, disregarding the date part.</short>
|
||||
<descr>
|
||||
<p>
|
||||
<var>CompareTime</var> compares the time parts of two timestamps <var>A</var> and
|
||||
<var>B</var> and returns the following results:
|
||||
</p>
|
||||
<dl>
|
||||
<dt>< 0</dt><dd>if the time part of <var>A</var> is earlier than the time part of <var>B</var>.</dd>
|
||||
<dt>0</dt><dd>if <var>A</var> and <var>B</var> have the same time part (dates may differ) .</dd>
|
||||
<dt>> 0</dt><dd>if the time part of <var>A</var> is later than the time part of <var>B</var>.</dd>
|
||||
</dl>
|
||||
</descr>
|
||||
<seealso>
|
||||
<link id="CompareDateTime"/>
|
||||
<link id="CompareDate"/>
|
||||
<link id="SameDate"/>
|
||||
<link id="SameTime"/>
|
||||
<link id="SameDateTime"/>
|
||||
</seealso>
|
||||
<example file="datutex/ex100"/>
|
||||
</element>
|
||||
|
||||
<!-- function result Visibility: default -->
|
||||
@ -4928,6 +5230,24 @@ if any of the arguments is not valid.
|
||||
<!-- function Visibility: default -->
|
||||
<element name="SameDateTime">
|
||||
<short>Check whether two <var>TDateTime</var> values have the same date and time parts.</short>
|
||||
<descr>
|
||||
<p>
|
||||
<var>SameDateTime</var> compares the date/time parts of two timestamps <var>A</var> and
|
||||
<var>B</var> and returns <var>True</var> if they are equal, <var>False</var>
|
||||
if they are not.
|
||||
</p>
|
||||
<p>
|
||||
The function simply checks whether <link id="CompareDateTime"/> returns zero.
|
||||
</p>
|
||||
</descr>
|
||||
<seealso>
|
||||
<link id="CompareDateTime"/>
|
||||
<link id="CompareDate"/>
|
||||
<link id="CompareTime"/>
|
||||
<link id="SameDate"/>
|
||||
<link id="SameTime"/>
|
||||
</seealso>
|
||||
<example file="datutex/ex101"/>
|
||||
</element>
|
||||
|
||||
<!-- function result Visibility: default -->
|
||||
@ -4948,6 +5268,24 @@ if any of the arguments is not valid.
|
||||
<!-- function Visibility: default -->
|
||||
<element name="SameDate">
|
||||
<short>Check whether two <var>TDateTime</var> values have the same date part.</short>
|
||||
<descr>
|
||||
<p>
|
||||
<var>SameDate</var> compares the date parts of two timestamps <var>A</var> and
|
||||
<var>B</var> and returns <var>True</var> if they are equal, <var>False</var>
|
||||
if they are not.
|
||||
</p>
|
||||
<p>
|
||||
The function simply checks whether <link id="CompareDate"/> returns zero.
|
||||
</p>
|
||||
</descr>
|
||||
<seealso>
|
||||
<link id="CompareDateTime"/>
|
||||
<link id="CompareDate"/>
|
||||
<link id="CompareTime"/>
|
||||
<link id="SameDateTime"/>
|
||||
<link id="SameTime"/>
|
||||
</seealso>
|
||||
<example file="datutex/ex102"/>
|
||||
</element>
|
||||
|
||||
<!-- function result Visibility: default -->
|
||||
@ -4968,6 +5306,24 @@ if any of the arguments is not valid.
|
||||
<!-- function Visibility: default -->
|
||||
<element name="SameTime">
|
||||
<short>Check whether two <var>TDateTime</var> values have the same time part.</short>
|
||||
<descr>
|
||||
<p>
|
||||
<var>SameTime</var> compares the time parts of two timestamps <var>A</var> and
|
||||
<var>B</var> and returns <var>True</var> if they are equal, <var>False</var>
|
||||
if they are not.
|
||||
</p>
|
||||
<p>
|
||||
The function simply checks whether <link id="CompareTime"/> returns zero.
|
||||
</p>
|
||||
</descr>
|
||||
<seealso>
|
||||
<link id="CompareDateTime"/>
|
||||
<link id="CompareDate"/>
|
||||
<link id="CompareTime"/>
|
||||
<link id="SameDateTime"/>
|
||||
<link id="SameDate"/>
|
||||
</seealso>
|
||||
<example file="datutex/ex103"/>
|
||||
</element>
|
||||
|
||||
<!-- function result Visibility: default -->
|
||||
@ -4988,6 +5344,19 @@ if any of the arguments is not valid.
|
||||
<!-- function Visibility: default -->
|
||||
<element name="NthDayOfWeek">
|
||||
<short>Calculate which occurrence of weekday in the month a given day represents</short>
|
||||
<descr>
|
||||
<var>NthDayOfWeek</var> returns the occurence of the weekday of <var>AValue</var> in the
|
||||
month. This is the N-th time that this weekday occurs in the month (e.g. the
|
||||
third saturday of the month).
|
||||
</descr>
|
||||
<seealso>
|
||||
<link id="EncodeDateMonthWeek"/>
|
||||
<link id="#rtl.sysutils.DayOfWeek"/>
|
||||
<link id="DecodeDayOfWeekInMonth"/>
|
||||
<link id="EncodeDayOfWeekInMonth"/>
|
||||
<link id="TryEncodeDayOfWeekInMonth"/>
|
||||
</seealso>
|
||||
<example file="datutex/ex104"/>
|
||||
</element>
|
||||
|
||||
<!-- function result Visibility: default -->
|
||||
@ -5003,6 +5372,21 @@ if any of the arguments is not valid.
|
||||
<!-- procedure Visibility: default -->
|
||||
<element name="DecodeDayOfWeekInMonth">
|
||||
<short>Decode a DateTime value in year, month, day of week parts</short>
|
||||
<descr>
|
||||
<var>DecodeDayOfWeekInMonth</var> decodes the date <var>AValue</var> in a
|
||||
<var>AYear</var>, <var>AMonth</var>, <var>ADayOfweek</var> and
|
||||
<var>ANthDayOfweek</var>.
|
||||
(This is the N-th time that this weekday occurs in the month, e.g. the
|
||||
third saturday of the month.)
|
||||
</descr>
|
||||
<seealso>
|
||||
<link id="NthDayOfWeek"/>
|
||||
<link id="EncodeDateMonthWeek"/>
|
||||
<link id="#rtl.sysutils.DayOfWeek"/>
|
||||
<link id="EncodeDayOfWeekInMonth"/>
|
||||
<link id="TryEncodeDayOfWeekInMonth"/>
|
||||
</seealso>
|
||||
<example file="datutex/ex105"/>
|
||||
</element>
|
||||
|
||||
<!-- argument Visibility: default -->
|
||||
@ -5033,6 +5417,31 @@ if any of the arguments is not valid.
|
||||
<!-- function Visibility: default -->
|
||||
<element name="EncodeDayOfWeekInMonth">
|
||||
<short>Encodes a year, month, week, day of week specification to a <var>TDateTime</var> value</short>
|
||||
<descr>
|
||||
<p>
|
||||
<var>EncodeDayOfWeekInMonth</var> encodes <var>AYear</var>, <var>AMonth</var>,
|
||||
<var>ADayOfweek</var> and <var>ANthDayOfweek</var> to a valid date stamp and
|
||||
returns the result.
|
||||
</p>
|
||||
<p>
|
||||
<var>ANthDayOfweek</var>is the N-th time that this weekday occurs in the month, e.g. the
|
||||
third saturday of the month.
|
||||
</p>
|
||||
<p>
|
||||
For an example, see <link id="DecodeDayOfWeekInMonth"/>.
|
||||
</p>
|
||||
</descr>
|
||||
<errors>
|
||||
If any of the values is not in range, then an <var>EConvertError</var>
|
||||
exception will be raised.
|
||||
</errors>
|
||||
<seealso>
|
||||
<link id="NthDayOfWeek"/>
|
||||
<link id="EncodeDateMonthWeek"/>
|
||||
<link id="#rtl.sysutils.DayOfWeek"/>
|
||||
<link id="DecodeDayOfWeekInMonth"/>
|
||||
<link id="TryEncodeDayOfWeekInMonth"/>
|
||||
</seealso>
|
||||
</element>
|
||||
|
||||
<!-- function result Visibility: default -->
|
||||
@ -5063,6 +5472,30 @@ if any of the arguments is not valid.
|
||||
<!-- function Visibility: default -->
|
||||
<element name="TryEncodeDayOfWeekInMonth">
|
||||
<short>Encode a year, month, week, day of week triplet to a <var>TDateTime</var> value</short>
|
||||
<descr>
|
||||
<p>
|
||||
<var>EncodeDayOfWeekInMonth</var> encodes
|
||||
<var>AYear</var>, <var>AMonth</var>, <var>ADayOfweek</var> and
|
||||
<var>ANthDayOfweek</var> to a valid date stamp and returns the result in
|
||||
<var>AValue</var>.
|
||||
</p>
|
||||
<p>
|
||||
<var>ANthDayOfweek</var>is the N-th time that this weekday occurs in the month, e.g. the
|
||||
third saturday of the month.
|
||||
</p>
|
||||
<p>
|
||||
The function returns <var>True</var> if the encoding was succesful,
|
||||
<var>False</var> if any of the values is not in range.
|
||||
</p>
|
||||
</descr>
|
||||
<seealso>
|
||||
<link id="NthDayOfWeek"/>
|
||||
<link id="EncodeDateMonthWeek"/>
|
||||
<link id="#rtl.sysutils.DayOfWeek"/>
|
||||
<link id="DecodeDayOfWeekInMonth"/>
|
||||
<link id="EncodeDayOfWeekInMonth"/>
|
||||
</seealso>
|
||||
<example file="datutex/ex106"/>
|
||||
</element>
|
||||
|
||||
<!-- function result Visibility: default -->
|
||||
@ -5104,6 +5537,25 @@ if any of the arguments is not valid.
|
||||
<!-- procedure Visibility: default -->
|
||||
<element name="InvalidDateTimeError">
|
||||
<short>Raise an <var>EConvertError</var> about an invalid date-time specification.</short>
|
||||
<descr>
|
||||
<p>
|
||||
<var>InvalidDateTimeError</var> raises an <link id="#rtl.sysutils.EConvertError">EConvertError</link>
|
||||
exception and formats the error message with an appropriate description made
|
||||
up from the parts <var>AYear</var>, <var>AMonth</var>,
|
||||
<var>ADay</var>,<var>AHour</var>, <var>AMinute</var>, <var>ASecond</var> and
|
||||
<var>AMilliSecond</var>.
|
||||
</p>
|
||||
<p>
|
||||
Normally this function should not be needed, the conversion routines call it
|
||||
when they have received invalid arguments.
|
||||
</p>
|
||||
</descr>
|
||||
<seealso>
|
||||
<link id="InvalidDateWeekError"/>
|
||||
<link id="InvalidDateDayError"/>
|
||||
<link id="InvalidDateMonthWeekError"/>
|
||||
<link id="InvalidDayOfWeekInMonthError"/>
|
||||
</seealso>
|
||||
</element>
|
||||
|
||||
<!-- argument Visibility: default -->
|
||||
@ -5144,11 +5596,58 @@ if any of the arguments is not valid.
|
||||
<!-- procedure Visibility: default -->
|
||||
<element name="InvalidDateWeekError">
|
||||
<short>Raise an EConvertError with an invalid Year, WeekOfyear and DayOfWeek specification</short>
|
||||
<descr>
|
||||
<p>
|
||||
<var>InvalidDateWeekError</var> raises an <link id="#rtl.sysutils.EConvertError">EConvertError</link>
|
||||
exception and formats the error message with an appropriate description made
|
||||
up from the parts <var>AYear</var>, <var>AWeek</var>,
|
||||
<var>ADayOfWeek</var>
|
||||
</p>
|
||||
<p>
|
||||
Normally this function should not be needed, the conversion routines call it
|
||||
when they have received invalid arguments.
|
||||
</p>
|
||||
</descr>
|
||||
<seealso>
|
||||
<link id="InvalidDateTime"/>
|
||||
<link id="InvalidDateDayError"/>
|
||||
<link id="InvalidDateMonthWeekError"/>
|
||||
<link id="InvalidDayOfWeekInMonthError"/>
|
||||
</seealso>
|
||||
</element>
|
||||
|
||||
<element name="InvalidDateWeekError.AYear">
|
||||
<short>The year</short>
|
||||
</element>
|
||||
|
||||
<element name="InvalidDateWeekError.AWeekOfYear">
|
||||
<short>The week</short>
|
||||
</element>
|
||||
|
||||
<element name="InvalidDateWeekError.ADayOfweek">
|
||||
<short>The day of theweek</short>
|
||||
</element>
|
||||
|
||||
<!-- procedure Visibility: default -->
|
||||
<element name="InvalidDateDayError">
|
||||
<short>Raise an <var>EConvertError</var> exception when a day is not a valid day of a year.</short>
|
||||
<descr>
|
||||
<p>
|
||||
<var>InvalidDateDayError</var> raises an <link id="#rtl.sysutils.EConvertError">EConvertError</link>
|
||||
exception and formats the error message with an appropriate description made
|
||||
up from the parts <var>AYear</var> and <var>ADayOfYear</var>.
|
||||
</p>
|
||||
<p>
|
||||
Normally this function should not be needed, the conversion routines call it
|
||||
when they have received invalid arguments.
|
||||
</p>
|
||||
</descr>
|
||||
<seealso>
|
||||
<link id="InvalidDateWeekError"/>
|
||||
<link id="InvalidDateTimeError"/>
|
||||
<link id="InvalidDateMonthWeekError"/>
|
||||
<link id="InvalidDayOfWeekInMonthError"/>
|
||||
</seealso>
|
||||
</element>
|
||||
|
||||
<!-- argument Visibility: default -->
|
||||
@ -5164,6 +5663,24 @@ if any of the arguments is not valid.
|
||||
<!-- procedure Visibility: default -->
|
||||
<element name="InvalidDateMonthWeekError">
|
||||
<short>Raise an <var>EConvertError</var> exception when a Year,Month,WeekOfMonth,DayofWeek is invalid.</short>
|
||||
<descr>
|
||||
<p>
|
||||
<var>InvalidDateMonthWeekError</var> raises an <link id="#rtl.sysutils.EConvertError">EConvertError</link>
|
||||
exception and formats the error message with an appropriate description made
|
||||
up from the parts <var>AYear</var>, <var>Amonth</var>,
|
||||
<var>AWeekOfMonth</var> and <var>ADayOfWeek</var>.
|
||||
</p>
|
||||
<p>
|
||||
Normally this function should not be needed, the conversion routines call it
|
||||
when they have received invalid arguments.
|
||||
</p>
|
||||
</descr>
|
||||
<seealso>
|
||||
<link id="InvalidDateWeekError"/>
|
||||
<link id="InvalidDateTimeError"/>
|
||||
<link id="InvalidDateDayError"/>
|
||||
<link id="InvalidDayOfWeekInMonthError"/>
|
||||
</seealso>
|
||||
</element>
|
||||
|
||||
<!-- argument Visibility: default -->
|
||||
@ -5189,6 +5706,24 @@ if any of the arguments is not valid.
|
||||
<!-- procedure Visibility: default -->
|
||||
<element name="InvalidDayOfWeekInMonthError">
|
||||
<short>Raise an <var>EConvertError</var> exception when a Year,Month,NthDayofWeek,DayofWeek is invalid.</short>
|
||||
<descr>
|
||||
<p>
|
||||
<var>InvalidDayOfWeekInMonthError</var> raises an <link id="#rtl.sysutils.EConvertError">EConvertError</link>
|
||||
exception and formats the error message with an appropriate description made
|
||||
up from the parts <var>AYear</var>, <var>Amonth</var>,
|
||||
<var>ANthDayOfWeek</var> and <var>ADayOfWeek</var>.
|
||||
</p>
|
||||
<p>
|
||||
Normally this function should not be needed, the conversion routines call it
|
||||
when they have received invalid arguments.
|
||||
</p>
|
||||
</descr>
|
||||
<seealso>
|
||||
<link id="InvalidDateWeekError"/>
|
||||
<link id="InvalidDateTimeError"/>
|
||||
<link id="InvalidDateDayError"/>
|
||||
<link id="InvalidDateMonthWeekError"/>
|
||||
</seealso>
|
||||
</element>
|
||||
|
||||
<!-- argument Visibility: default -->
|
||||
@ -5214,6 +5749,18 @@ if any of the arguments is not valid.
|
||||
<!-- function Visibility: default -->
|
||||
<element name="DateTimeToJulianDate">
|
||||
<short>Converts a TDateTime value to a Julian date representation</short>
|
||||
<descr>
|
||||
Not yet implemented.
|
||||
</descr>
|
||||
<errors>
|
||||
Currently, trying to use this function will raise an exception.
|
||||
</errors>
|
||||
<seealso>
|
||||
<link id="JulianDateToDateTime"/>
|
||||
<link id="TryJulianDateToDateTime"/>
|
||||
<link id="DateTimeToModifiedJulianDate"/>
|
||||
<link id="TryModifiedJulianDateToDateTime"/>
|
||||
</seealso>
|
||||
</element>
|
||||
|
||||
<!-- function result Visibility: default -->
|
||||
@ -5229,6 +5776,18 @@ if any of the arguments is not valid.
|
||||
<!-- function Visibility: default -->
|
||||
<element name="JulianDateToDateTime">
|
||||
<short>Convert a Julian date representation to a <var>TDateTime</var> value.</short>
|
||||
<descr>
|
||||
Not yet implemented.
|
||||
</descr>
|
||||
<errors>
|
||||
Currently, trying to use this function will raise an exception.
|
||||
</errors>
|
||||
<seealso>
|
||||
<link id="DateTimeToJulianDate"/>
|
||||
<link id="TryJulianDateToDateTime"/>
|
||||
<link id="DateTimeToModifiedJulianDate"/>
|
||||
<link id="TryModifiedJulianDateToDateTime"/>
|
||||
</seealso>
|
||||
</element>
|
||||
|
||||
<!-- function result Visibility: default -->
|
||||
@ -5244,6 +5803,18 @@ if any of the arguments is not valid.
|
||||
<!-- function Visibility: default -->
|
||||
<element name="TryJulianDateToDateTime">
|
||||
<short>Convert a Julian date representation to a <var>TDateTime</var> value.</short>
|
||||
<descr>
|
||||
Not yet implemented.
|
||||
</descr>
|
||||
<errors>
|
||||
Currently, trying to use this function will raise an exception.
|
||||
</errors>
|
||||
<seealso>
|
||||
<link id="DateTimeToJulianDate"/>
|
||||
<link id="JulianDateToDateTime"/>
|
||||
<link id="DateTimeToModifiedJulianDate"/>
|
||||
<link id="TryModifiedJulianDateToDateTime"/>
|
||||
</seealso>
|
||||
</element>
|
||||
|
||||
<!-- function result Visibility: default -->
|
||||
@ -5264,6 +5835,18 @@ if any of the arguments is not valid.
|
||||
<!-- function Visibility: default -->
|
||||
<element name="DateTimeToModifiedJulianDate">
|
||||
<short>Convert a <var>TDateTime</var> value to a modified Julian date representation</short>
|
||||
<descr>
|
||||
Not yet implemented.
|
||||
</descr>
|
||||
<errors>
|
||||
Currently, trying to use this function will raise an exception.
|
||||
</errors>
|
||||
<seealso>
|
||||
<link id="DateTimeToJulianDate"/>
|
||||
<link id="JulianDateToDateTime"/>
|
||||
<link id="TryJulianDateToDateTime"/>
|
||||
<link id="TryModifiedJulianDateToDateTime"/>
|
||||
</seealso>
|
||||
</element>
|
||||
|
||||
<!-- function result Visibility: default -->
|
||||
@ -5279,6 +5862,19 @@ if any of the arguments is not valid.
|
||||
<!-- function Visibility: default -->
|
||||
<element name="ModifiedJulianDateToDateTime">
|
||||
<short>Convert a modified Julian date representation to a <var>TDateTime</var> value.</short>
|
||||
<descr>
|
||||
Not yet implemented.
|
||||
</descr>
|
||||
<errors>
|
||||
Currently, trying to use this function will raise an exception.
|
||||
</errors>
|
||||
<seealso>
|
||||
<link id="DateTimeToJulianDate"/>
|
||||
<link id="JulianDateToDateTime"/>
|
||||
<link id="TryJulianDateToDateTime"/>
|
||||
<link id="DateTimeToModifiedJulianDate"/>
|
||||
<link id="TryModifiedJulianDateToDateTime"/>
|
||||
</seealso>
|
||||
</element>
|
||||
|
||||
<!-- function result Visibility: default -->
|
||||
@ -5294,6 +5890,19 @@ if any of the arguments is not valid.
|
||||
<!-- function Visibility: default -->
|
||||
<element name="TryModifiedJulianDateToDateTime">
|
||||
<short>Convert a modified Julian date representation to a <var>TDateTime</var> value.</short>
|
||||
<descr>
|
||||
Not yet implemented.
|
||||
</descr>
|
||||
<errors>
|
||||
Currently, trying to use this function will raise an exception.
|
||||
</errors>
|
||||
<seealso>
|
||||
<link id="DateTimeToJulianDate"/>
|
||||
<link id="JulianDateToDateTime"/>
|
||||
<link id="TryJulianDateToDateTime"/>
|
||||
<link id="DateTimeToModifiedJulianDate"/>
|
||||
<link id="ModifiedJulianDateToDateTime"/>
|
||||
</seealso>
|
||||
</element>
|
||||
|
||||
<!-- function result Visibility: default -->
|
||||
@ -5314,6 +5923,15 @@ if any of the arguments is not valid.
|
||||
<!-- function Visibility: default -->
|
||||
<element name="DateTimeToUnix">
|
||||
<short>Convert a <var>TDateTime</var> value to Unix epoch time</short>
|
||||
<descr>
|
||||
Not yet implemented.
|
||||
</descr>
|
||||
<errors>
|
||||
Currently, trying to use this function will raise an exception.
|
||||
</errors>
|
||||
<seealso>
|
||||
<link id="UnixToDateTime"/>
|
||||
</seealso>
|
||||
</element>
|
||||
|
||||
<!-- function result Visibility: default -->
|
||||
@ -5329,6 +5947,15 @@ if any of the arguments is not valid.
|
||||
<!-- function Visibility: default -->
|
||||
<element name="UnixToDateTime">
|
||||
<short>Convert Unix epoch time to a <var>TDateTime</var> value</short>
|
||||
<descr>
|
||||
Not yet implemented.
|
||||
</descr>
|
||||
<errors>
|
||||
Currently, trying to use this function will raise an exception.
|
||||
</errors>
|
||||
<seealso>
|
||||
<link id="DateTimeToUnix"/>
|
||||
</seealso>
|
||||
</element>
|
||||
|
||||
<!-- function result Visibility: default -->
|
||||
|
@ -59,19 +59,12 @@ OBJECTS=ex1 ex2 ex3 ex4 ex5 ex6 ex7 ex8 ex9 ex10 ex11 ex12\
|
||||
ex59 ex60 ex61 ex62 ex63 ex64 ex65 ex66 ex67 ex68 ex69 ex70\
|
||||
ex71 ex72 ex73 ex74 ex75 ex76 ex77 ex78 ex79 ex80 \
|
||||
ex81 ex82 ex83 ex84 ex85 ex86 ex87 ex88 ex89 ex90 ex91 ex92 \
|
||||
ex93
|
||||
ex93 ex94 ex95 ex96 ex97 ex98 ex99 ex100 ex101 ex102 ex103\
|
||||
ex104 ex105 ex106
|
||||
|
||||
# This might not be the same list as objects, since some of the
|
||||
# tests might be interactive.
|
||||
TOTEST=ex1 ex2 ex3 ex4 ex5 ex6 ex7 ex8 ex9 ex10 ex11 ex12\
|
||||
ex13 ex14 ex15 ex16 ex17 ex18 ex19 ex20 ex21 ex22 ex23 ex24\
|
||||
ex25 ex26 ex27 ex28 ex29 ex30 ex31 ex32 ex35 ex36\
|
||||
ex37 ex39 ex41 ex42 ex43 ex44 ex45 ex46 ex47\
|
||||
ex48 ex49 ex50 ex51 ex52 ex53 ex54 ex55 ex56 ex57 ex58\
|
||||
ex59 ex60 ex61 ex62 ex63 ex64 ex65 ex66 ex67 ex68 ex69 ex70\
|
||||
ex72 ex73 ex74 ex75 ex76 ex77 ex78 ex79 ex80 \
|
||||
ex81 ex82 ex83 ex84 ex85 ex86 ex87 ex88 ex89 ex90 ex91 ex92 \
|
||||
ex93
|
||||
TOTEST=OBJECTS
|
||||
|
||||
LOGFILE=$(addsuffix .log, $(TOTEST))
|
||||
|
||||
|
@ -75,3 +75,21 @@ 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.
|
||||
ex87.pp contains an example of the RecodeYear function.
|
||||
ex88.pp contains an example of the RecodeMonth function.
|
||||
ex89.pp contains an example of the RecodeDay function.
|
||||
ex90.pp contains an example of the RecodeHour function.
|
||||
ex91.pp contains an example of the RecodeMinute function.
|
||||
ex92.pp contains an example of the RecodeSecond function.
|
||||
ex93.pp contains an example of the RecodeMilliSecond function.
|
||||
ex94.pp contains an example of the RecodeDate function.
|
||||
ex95.pp contains an example of the RecodeTime function.
|
||||
ex96.pp contains an example of the RecodeDateTime function.
|
||||
ex96.pp contains an example of the TryRecodeDateTime function.
|
||||
ex98.pp contains an example of the CompareDateTime function.
|
||||
ex99.pp contains an example of the CompareDate function.
|
||||
ex100.pp contains an example of the CompareTime function.
|
||||
ex101.pp contains an example of the SameDateTime function.
|
||||
ex104.pp contains an example of the NthDayOfWeek function.
|
||||
ex105.pp contains an example of the DecodeDayOfWeekInMonth function.
|
||||
ex106.pp contains an example of the TryEncodeDayOfWeekInMonth function.
|
||||
|
39
docs/datutex/ex100.pp
Normal file
39
docs/datutex/ex100.pp
Normal file
@ -0,0 +1,39 @@
|
||||
Program Example100;
|
||||
|
||||
{ This program demonstrates the CompareTime function }
|
||||
|
||||
Uses SysUtils,DateUtils;
|
||||
|
||||
Const
|
||||
Fmt = 'dddd dd mmmm yyyy hh:nn:ss.zzz';
|
||||
|
||||
Procedure Test(D1,D2 : TDateTime);
|
||||
|
||||
Var
|
||||
Cmp : Integer;
|
||||
|
||||
begin
|
||||
Write(FormatDateTime(Fmt,D1),' has ');
|
||||
Cmp:=CompareDateTime(D1,D2);
|
||||
If Cmp<0 then
|
||||
write('earlier time than ')
|
||||
else if Cmp>0 then
|
||||
Write('later time than ')
|
||||
else
|
||||
Write('equal time with ');
|
||||
Writeln(FormatDateTime(Fmt,D2));
|
||||
end;
|
||||
|
||||
Var
|
||||
D,N : TDateTime;
|
||||
|
||||
Begin
|
||||
D:=Today;
|
||||
N:=Now;
|
||||
Test(D,D);
|
||||
Test(N,N);
|
||||
Test(N+1,N);
|
||||
Test(N-1,N);
|
||||
Test(N+OneSecond,N);
|
||||
Test(N-OneSecond,N);
|
||||
End.
|
29
docs/datutex/ex101.pp
Normal file
29
docs/datutex/ex101.pp
Normal file
@ -0,0 +1,29 @@
|
||||
Program Example101;
|
||||
|
||||
{ This program demonstrates the SameDateTime function }
|
||||
|
||||
Uses SysUtils,DateUtils;
|
||||
|
||||
Const
|
||||
Fmt = 'dddd dd mmmm yyyy hh:nn:ss.zzz';
|
||||
|
||||
Procedure Test(D1,D2 : TDateTime);
|
||||
|
||||
begin
|
||||
Write(FormatDateTime(Fmt,D1),' is the same datetime as ');
|
||||
Writeln(FormatDateTime(Fmt,D2),' : ',SameDateTime(D1,D2));
|
||||
end;
|
||||
|
||||
Var
|
||||
D,N : TDateTime;
|
||||
|
||||
Begin
|
||||
D:=Today;
|
||||
N:=Now;
|
||||
Test(D,D);
|
||||
Test(N,N);
|
||||
Test(N+1,N);
|
||||
Test(N-1,N);
|
||||
Test(N+OneSecond,N);
|
||||
Test(N-OneSecond,N);
|
||||
End.
|
29
docs/datutex/ex102.pp
Normal file
29
docs/datutex/ex102.pp
Normal file
@ -0,0 +1,29 @@
|
||||
Program Example102;
|
||||
|
||||
{ This program demonstrates the SameDate function }
|
||||
|
||||
Uses SysUtils,DateUtils;
|
||||
|
||||
Const
|
||||
Fmt = 'dddd dd mmmm yyyy hh:nn:ss.zzz';
|
||||
|
||||
Procedure Test(D1,D2 : TDateTime);
|
||||
|
||||
begin
|
||||
Write(FormatDateTime(Fmt,D1),' is the same date as ');
|
||||
Writeln(FormatDateTime(Fmt,D2),' : ',SameDate(D1,D2));
|
||||
end;
|
||||
|
||||
Var
|
||||
D,N : TDateTime;
|
||||
|
||||
Begin
|
||||
D:=Today;
|
||||
N:=Now;
|
||||
Test(D,D);
|
||||
Test(N,N);
|
||||
Test(N+1,N);
|
||||
Test(N-1,N);
|
||||
Test(N+OneSecond,N);
|
||||
Test(N-OneSecond,N);
|
||||
End.
|
29
docs/datutex/ex103.pp
Normal file
29
docs/datutex/ex103.pp
Normal file
@ -0,0 +1,29 @@
|
||||
Program Example102;
|
||||
|
||||
{ This program demonstrates the SameTime function }
|
||||
|
||||
Uses SysUtils,DateUtils;
|
||||
|
||||
Const
|
||||
Fmt = 'dddd dd mmmm yyyy hh:nn:ss.zzz';
|
||||
|
||||
Procedure Test(D1,D2 : TDateTime);
|
||||
|
||||
begin
|
||||
Write(FormatDateTime(Fmt,D1),' is the same time as ');
|
||||
Writeln(FormatDateTime(Fmt,D2),' : ',SameTime(D1,D2));
|
||||
end;
|
||||
|
||||
Var
|
||||
D,N : TDateTime;
|
||||
|
||||
Begin
|
||||
D:=Today;
|
||||
N:=Now;
|
||||
Test(D,D);
|
||||
Test(N,N);
|
||||
Test(N+1,N);
|
||||
Test(N-1,N);
|
||||
Test(N+OneSecond,N);
|
||||
Test(N-OneSecond,N);
|
||||
End.
|
10
docs/datutex/ex104.pp
Normal file
10
docs/datutex/ex104.pp
Normal file
@ -0,0 +1,10 @@
|
||||
Program Example104;
|
||||
|
||||
{ This program demonstrates the NthDayOfWeek function }
|
||||
|
||||
Uses SysUtils,DateUtils;
|
||||
|
||||
Begin
|
||||
Write('Today is the ',NthDayOfWeek(Today),'-th ');
|
||||
Writeln(formatdateTime('dddd',Today),' of the month.');
|
||||
End.
|
15
docs/datutex/ex105.pp
Normal file
15
docs/datutex/ex105.pp
Normal file
@ -0,0 +1,15 @@
|
||||
Program Example105;
|
||||
|
||||
{ This program demonstrates the DecodeDayOfWeekInMonth function }
|
||||
|
||||
Uses SysUtils,DateUtils;
|
||||
|
||||
Var
|
||||
Y,M,NDoW,DoW : Word;
|
||||
D : TDateTime;
|
||||
Begin
|
||||
DecodeDayOfWeekInMonth(Date,Y,M,NDoW,DoW);
|
||||
D:=EncodeDayOfWeekInMonth(Y,M,NDoW,DoW);
|
||||
Write(DateToStr(D),' is the ',NDow,'-th ');
|
||||
Writeln(formatdateTime('dddd',D),' of the month.');
|
||||
End.
|
19
docs/datutex/ex106.pp
Normal file
19
docs/datutex/ex106.pp
Normal file
@ -0,0 +1,19 @@
|
||||
Program Example105;
|
||||
|
||||
{ This program demonstrates the DecodeDayOfWeekInMonth function }
|
||||
|
||||
Uses SysUtils,DateUtils;
|
||||
|
||||
Var
|
||||
Y,M,NDoW,DoW : Word;
|
||||
D : TDateTime;
|
||||
Begin
|
||||
DecodeDayOfWeekInMonth(Date,Y,M,NDoW,DoW);
|
||||
If TryEncodeDayOfWeekInMonth(Y,M,NDoW,DoW,D) then
|
||||
begin
|
||||
Write(DateToStr(D),' is the ',NDow,'-th ');
|
||||
Writeln(formatdateTime('dddd',D),' of the month.');
|
||||
end
|
||||
else
|
||||
Writeln('Invalid year/month/NthDayOfweek combination');
|
||||
End.
|
16
docs/datutex/ex87.pp
Normal file
16
docs/datutex/ex87.pp
Normal file
@ -0,0 +1,16 @@
|
||||
Program Example87;
|
||||
|
||||
{ This program demonstrates the RecodeYear function }
|
||||
|
||||
Uses SysUtils,DateUtils;
|
||||
|
||||
Const
|
||||
Fmt = 'dddd dd mmmm yyyy hh:nn:ss';
|
||||
|
||||
Var
|
||||
S : AnsiString;
|
||||
|
||||
Begin
|
||||
S:=FormatDateTime(Fmt,RecodeYear(Now,1999));
|
||||
Writeln('This moment in 1999 : ',S);
|
||||
End.
|
16
docs/datutex/ex88.pp
Normal file
16
docs/datutex/ex88.pp
Normal file
@ -0,0 +1,16 @@
|
||||
Program Example88;
|
||||
|
||||
{ This program demonstrates the RecodeMonth function }
|
||||
|
||||
Uses SysUtils,DateUtils;
|
||||
|
||||
Const
|
||||
Fmt = 'dddd dd mmmm yyyy hh:nn:ss';
|
||||
|
||||
Var
|
||||
S : AnsiString;
|
||||
|
||||
Begin
|
||||
S:=FormatDateTime(Fmt,RecodeMonth(Now,5));
|
||||
Writeln('This moment in May : ',S);
|
||||
End.
|
16
docs/datutex/ex89.pp
Normal file
16
docs/datutex/ex89.pp
Normal file
@ -0,0 +1,16 @@
|
||||
Program Example89;
|
||||
|
||||
{ This program demonstrates the RecodeDay function }
|
||||
|
||||
Uses SysUtils,DateUtils;
|
||||
|
||||
Const
|
||||
Fmt = 'dddd dd mmmm yyyy hh:nn:ss';
|
||||
|
||||
Var
|
||||
S : AnsiString;
|
||||
|
||||
Begin
|
||||
S:=FormatDateTime(Fmt,RecodeDay(Now,1));
|
||||
Writeln('This moment on the first of the month : ',S);
|
||||
End.
|
16
docs/datutex/ex90.pp
Normal file
16
docs/datutex/ex90.pp
Normal file
@ -0,0 +1,16 @@
|
||||
Program Example90;
|
||||
|
||||
{ This program demonstrates the RecodeHour function }
|
||||
|
||||
Uses SysUtils,DateUtils;
|
||||
|
||||
Const
|
||||
Fmt = 'dddd dd mmmm yyyy hh:nn:ss';
|
||||
|
||||
Var
|
||||
S : AnsiString;
|
||||
|
||||
Begin
|
||||
S:=FormatDateTime(Fmt,RecodeHour(Now,0));
|
||||
Writeln('Today, in the first hour : ',S);
|
||||
End.
|
16
docs/datutex/ex91.pp
Normal file
16
docs/datutex/ex91.pp
Normal file
@ -0,0 +1,16 @@
|
||||
Program Example91;
|
||||
|
||||
{ This program demonstrates the RecodeMinute function }
|
||||
|
||||
Uses SysUtils,DateUtils;
|
||||
|
||||
Const
|
||||
Fmt = 'dddd dd mmmm yyyy hh:nn:ss';
|
||||
|
||||
Var
|
||||
S : AnsiString;
|
||||
|
||||
Begin
|
||||
S:=FormatDateTime(Fmt,RecodeMinute(Now,0));
|
||||
Writeln('This moment in the first minute of the hour: ',S);
|
||||
End.
|
16
docs/datutex/ex92.pp
Normal file
16
docs/datutex/ex92.pp
Normal file
@ -0,0 +1,16 @@
|
||||
Program Example92;
|
||||
|
||||
{ This program demonstrates the RecodeSecond function }
|
||||
|
||||
Uses SysUtils,DateUtils;
|
||||
|
||||
Const
|
||||
Fmt = 'dddd dd mmmm yyyy hh:nn:ss';
|
||||
|
||||
Var
|
||||
S : AnsiString;
|
||||
|
||||
Begin
|
||||
S:=FormatDateTime(Fmt,RecodeSecond(Now,0));
|
||||
Writeln('This moment, seconds stripped : ',S);
|
||||
End.
|
16
docs/datutex/ex93.pp
Normal file
16
docs/datutex/ex93.pp
Normal file
@ -0,0 +1,16 @@
|
||||
Program Example93;
|
||||
|
||||
{ This program demonstrates the RecodeMilliSecond function }
|
||||
|
||||
Uses SysUtils,DateUtils;
|
||||
|
||||
Const
|
||||
Fmt = 'dddd dd mmmm yyyy hh:nn:ss.zzz';
|
||||
|
||||
Var
|
||||
S : AnsiString;
|
||||
|
||||
Begin
|
||||
S:=FormatDateTime(Fmt,RecodeMilliSecond(Now,0));
|
||||
Writeln('This moment, milliseconds stripped : ',S);
|
||||
End.
|
16
docs/datutex/ex94.pp
Normal file
16
docs/datutex/ex94.pp
Normal file
@ -0,0 +1,16 @@
|
||||
Program Example94;
|
||||
|
||||
{ This program demonstrates the RecodeDate function }
|
||||
|
||||
Uses SysUtils,DateUtils;
|
||||
|
||||
Const
|
||||
Fmt = 'dddd dd mmmm yyyy hh:nn:ss';
|
||||
|
||||
Var
|
||||
S : AnsiString;
|
||||
|
||||
Begin
|
||||
S:=FormatDateTime(Fmt,RecodeDate(Now,2001,1,1));
|
||||
Writeln('This moment on the first of the millenium : ',S);
|
||||
End.
|
16
docs/datutex/ex95.pp
Normal file
16
docs/datutex/ex95.pp
Normal file
@ -0,0 +1,16 @@
|
||||
Program Example95;
|
||||
|
||||
{ This program demonstrates the RecodeTime function }
|
||||
|
||||
Uses SysUtils,DateUtils;
|
||||
|
||||
Const
|
||||
Fmt = 'dddd dd mmmm yyyy hh:nn:ss';
|
||||
|
||||
Var
|
||||
S : AnsiString;
|
||||
|
||||
Begin
|
||||
S:=FormatDateTime(Fmt,RecodeTime(Now,8,0,0,0));
|
||||
Writeln('Today, 8 AM : ',S);
|
||||
End.
|
19
docs/datutex/ex96.pp
Normal file
19
docs/datutex/ex96.pp
Normal file
@ -0,0 +1,19 @@
|
||||
Program Example96;
|
||||
|
||||
{ This program demonstrates the RecodeDateTime function }
|
||||
|
||||
Uses SysUtils,DateUtils;
|
||||
|
||||
Const
|
||||
Fmt = 'dddd dd mmmm yyyy hh:nn:ss';
|
||||
|
||||
Var
|
||||
S : AnsiString;
|
||||
D : TDateTime ;
|
||||
|
||||
Begin
|
||||
D:=Now;
|
||||
D:=RecodeDateTime(D,2000,2,RecodeLeaveFieldAsIs,0,0,0,0);
|
||||
S:=FormatDateTime(Fmt,D);
|
||||
Writeln('This moment in februari 2000 : ',S);
|
||||
End.
|
22
docs/datutex/ex97.pp
Normal file
22
docs/datutex/ex97.pp
Normal file
@ -0,0 +1,22 @@
|
||||
Program Example97;
|
||||
|
||||
{ This program demonstrates the TryRecodeDateTime function }
|
||||
|
||||
Uses SysUtils,DateUtils;
|
||||
|
||||
Const
|
||||
Fmt = 'dddd dd mmmm yyyy hh:nn:ss';
|
||||
|
||||
Var
|
||||
S : AnsiString;
|
||||
D : TDateTime ;
|
||||
|
||||
Begin
|
||||
If TryRecodeDateTime(Now,2000,2,RecodeLeaveFieldAsIs,0,0,0,0,D) then
|
||||
begin
|
||||
S:=FormatDateTime(Fmt,D);
|
||||
Writeln('This moment in februari 2000 : ',S);
|
||||
end
|
||||
else
|
||||
Writeln('This moment did/does not exist in februari 2000');
|
||||
End.
|
41
docs/datutex/ex98.pp
Normal file
41
docs/datutex/ex98.pp
Normal file
@ -0,0 +1,41 @@
|
||||
Program Example98;
|
||||
|
||||
{ This program demonstrates the CompareDateTime function }
|
||||
|
||||
Uses SysUtils,DateUtils;
|
||||
|
||||
Const
|
||||
Fmt = 'dddd dd mmmm yyyy hh:nn:ss.zzz';
|
||||
|
||||
Procedure Test(D1,D2 : TDateTime);
|
||||
|
||||
Var
|
||||
Cmp : Integer;
|
||||
|
||||
begin
|
||||
Write(FormatDateTime(Fmt,D1),' is ');
|
||||
Cmp:=CompareDateTime(D1,D2);
|
||||
If Cmp<0 then
|
||||
write('earlier than ')
|
||||
else if Cmp>0 then
|
||||
Write('later than ')
|
||||
else
|
||||
Write('equal to ');
|
||||
Writeln(FormatDateTime(Fmt,D2));
|
||||
end;
|
||||
|
||||
Var
|
||||
D,N : TDateTime;
|
||||
|
||||
Begin
|
||||
D:=Today;
|
||||
N:=Now;
|
||||
Test(D,D);
|
||||
Test(N,N);
|
||||
Test(D+1,D);
|
||||
Test(D-1,D);
|
||||
Test(D+OneSecond,D);
|
||||
Test(D-OneSecond,D);
|
||||
Test(N+OneSecond,N);
|
||||
Test(N-OneSecond,N);
|
||||
End.
|
41
docs/datutex/ex99.pp
Normal file
41
docs/datutex/ex99.pp
Normal file
@ -0,0 +1,41 @@
|
||||
Program Example99;
|
||||
|
||||
{ This program demonstrates the CompareDate function }
|
||||
|
||||
Uses SysUtils,DateUtils;
|
||||
|
||||
Const
|
||||
Fmt = 'dddd dd mmmm yyyy';
|
||||
|
||||
Procedure Test(D1,D2 : TDateTime);
|
||||
|
||||
Var
|
||||
Cmp : Integer;
|
||||
|
||||
begin
|
||||
Write(FormatDateTime(Fmt,D1),' is ');
|
||||
Cmp:=CompareDate(D1,D2);
|
||||
If Cmp<0 then
|
||||
write('earlier than ')
|
||||
else if Cmp>0 then
|
||||
Write('later than ')
|
||||
else
|
||||
Write('equal to ');
|
||||
Writeln(FormatDateTime(Fmt,D2));
|
||||
end;
|
||||
|
||||
Var
|
||||
D,N : TDateTime;
|
||||
|
||||
Begin
|
||||
D:=Today;
|
||||
N:=Now;
|
||||
Test(D,D);
|
||||
Test(N,N);
|
||||
Test(D+1,D);
|
||||
Test(D-1,D);
|
||||
Test(D+OneSecond,D);
|
||||
Test(D-OneSecond,D);
|
||||
Test(N+OneSecond,N);
|
||||
Test(N-OneSecond,N);
|
||||
End.
|
Loading…
Reference in New Issue
Block a user