From cca310e33dcf8a9f1c32f3cc2bb442c60b6bc0cb Mon Sep 17 00:00:00 2001 From: michael Date: Wed, 29 Dec 2004 19:06:22 +0000 Subject: [PATCH] + Second batch of descriptions and examples --- docs/dateutils.xml | 407 ++++++++++++++++++++++++++++++++++++++++--- docs/datutex/README | 16 ++ docs/datutex/ex27.pp | 2 +- docs/datutex/ex28.pp | 12 ++ docs/datutex/ex29.pp | 12 ++ docs/datutex/ex30.pp | 16 ++ docs/datutex/ex31.pp | 16 ++ docs/datutex/ex32.pp | 12 ++ docs/datutex/ex33.pp | 12 ++ docs/datutex/ex34.pp | 19 ++ docs/datutex/ex35.pp | 19 ++ docs/datutex/ex36.pp | 13 ++ docs/datutex/ex37.pp | 13 ++ docs/datutex/ex38.pp | 20 +++ docs/datutex/ex39.pp | 20 +++ docs/datutex/ex40.pp | 20 +++ 16 files changed, 605 insertions(+), 24 deletions(-) create mode 100644 docs/datutex/ex28.pp create mode 100644 docs/datutex/ex29.pp create mode 100644 docs/datutex/ex30.pp create mode 100644 docs/datutex/ex31.pp create mode 100644 docs/datutex/ex32.pp create mode 100644 docs/datutex/ex33.pp create mode 100644 docs/datutex/ex34.pp create mode 100644 docs/datutex/ex35.pp create mode 100644 docs/datutex/ex36.pp create mode 100644 docs/datutex/ex37.pp create mode 100644 docs/datutex/ex38.pp create mode 100644 docs/datutex/ex39.pp create mode 100644 docs/datutex/ex40.pp diff --git a/docs/dateutils.xml b/docs/dateutils.xml index 1da4d14496..02214b6ffa 100644 --- a/docs/dateutils.xml +++ b/docs/dateutils.xml @@ -1193,6 +1193,10 @@ returns a TDateTime value with the date of the last day of that year + + + + @@ -1218,6 +1222,10 @@ returns a TDateTime value with the date of the last day of that year + + + + @@ -1243,6 +1251,10 @@ returns a TDateTime value with the date of the last day of the year < + + + + @@ -1260,6 +1272,21 @@ returns a TDateTime value with the date of the last day of the year < Calculate the first day of the month, given a date in that month. + +StartOfTheMonth extracts the year and month parts of AValue and +returns a TDateTime value with the date of the first day of that year +and month as the function. + + + + + + + + + + + @@ -1275,6 +1302,21 @@ returns a TDateTime value with the date of the last day of the year < Calculate a DateTime value representing the last day of the month, given a day in that month. + +EndOfTheMonth extracts the year and month parts of AValue and +returns a TDateTime value with the date of the first day of that year +and month as the function. + + + + + + + + + + + @@ -1290,6 +1332,21 @@ returns a TDateTime value with the date of the last day of the year < Return first date of month, given a year/month pair. + +StartOfAMonth e +returns a TDateTime value with the date of the first day of the +month indicated by the AYear, AMonth pair. + + + + + + + + + + + @@ -1310,6 +1367,21 @@ returns a TDateTime value with the date of the last day of the year < Calculate a datetime value representing the last day of the indicated month + +EndOfAMonth e +returns a TDateTime value with the date of the last day of the +month indicated by the AYear, AMonth pair. + + + + + + + + + + + @@ -1330,6 +1402,22 @@ returns a TDateTime value with the date of the last day of the year < Return the first day of the week, given a date. + +StartOfTheWeek extracts the year and week parts of AValue and +returns a TDateTime value with the date of the first day of that +week as the function. + + + + + + + + + + + + @@ -1345,6 +1433,22 @@ returns a TDateTime value with the date of the last day of the year < Calculate a DateTime value which represents the end of a week, given a date in that week. + +EndOfTheWeek extracts the year and week parts of AValue and +returns a TDateTime value with the date of the last day of that +week as the function. + + + + + + + + + + + + @@ -1359,7 +1463,29 @@ returns a TDateTime value with the date of the last day of the year < -Return the first day of the week, given a year and a week in the year. +Return a day of the week, given a year, week and day in the week. + +

+StartOfAWeek +returns a TDateTime value with the date of the indicated day of the +week indicated by the AYear, AWeek, +ADayOfWeek values. +

+

+The default value for ADayOfWeek is 1. +

+
+ + + + + + + + + + +
@@ -1384,7 +1510,28 @@ returns a TDateTime value with the date of the last day of the year < - +Return the last moment of day of the week, given a year and a week in the year. + +

+EndOfAWeek returns a TDateTime value with the date of the +last moment (23:59:59:999) on the indicated day of the week indicated by the +AYear, AWeek, ADayOfWeek values. +

+

+The default value for ADayOfWeek is 7. +

+
+ + + + + + + + + + +
@@ -1407,29 +1554,32 @@ returns a TDateTime value with the date of the last day of the year < Day of the week - - -Calculate a datetime value which represents the end of a specified week. - - - - -DateTime value representing the end of the week specified by AYear, AWeekOfYear and DayOfWeek - - - - -Year - - - - -Week of the year - - Calculate the start of the day as a DateTime value, given a moment in the day. + +

+StartOfTheDay extracts the date part of AValue and +returns a TDateTime value with the date/time indication of +the start (0:0:0.000) of this day. +

+
+ + + + + + + + + + + + + + + +
@@ -1445,6 +1595,29 @@ returns a TDateTime value with the date of the last day of the year < Calculate a datetime value that represents the end of a given day. + +

+EndOfTheDay extracts the date part of AValue and +returns a TDateTime value with the date/time indication of +the last moment (23:59:59.999) of this day. +

+
+ + + + + + + + + + + + + + + +
@@ -1460,6 +1633,33 @@ returns a TDateTime value with the date of the last day of the year < Return the start of a day as a DateTime value, given a day indication + +

+StartOfADay +returns a TDateTime value with the date/time indication of +the start (0:0:0.000) of the day given by AYear, +AMonth, ADay. +

+

+The day may also be indicated with a AYear, ADayOfYear pair. +

+
+ + + + + + + + + + + + + + + +
@@ -1490,6 +1690,33 @@ returns a TDateTime value with the date of the last day of the year < Calculates a DateTime value representing the end of a specified day + +

+EndOfADay +returns a TDateTime value with the date/time indication of +the last moment (23:59:59.999) of the day given by AYear, +AMonth, ADay. +

+

+The day may also be indicated with a AYear, ADayOfYear pair. +

+
+ + + + + + + + + + + + + + + +
@@ -1520,6 +1747,25 @@ returns a TDateTime value with the date of the last day of the year < Extract the month of a DateTime indication. + +

+MonthOfTheYear extracts the month part of Avalue and +returns it. It is an alias for , and is provided for +completeness only, corresponding to the other PartOfTheYear functions. +

+

+For an example, see the function. +

+
+ + + + + + + + +
@@ -1535,6 +1781,28 @@ returns a TDateTime value with the date of the last day of the year < Extract the week of the year (and optionally year) of a DateTime indication. + +

+WeekOfTheYear extracts the week of the year from Avalue and +returns it, and optionally returns the year as well. It returns the same value as . +

+ +Note that weeks are numbered from 1 using the ISO 8601 standard, and the day of the week as well. +This means that the year may not be the same as the year part of the date, since the week may +start in the previous year as the first week of the year is the week with at +least 4 days in it. + +
+ + + + + + + + + +
@@ -1555,7 +1823,25 @@ returns a TDateTime value with the date of the last day of the year < -Extracts the day of the week from a DateTime value +Extracts the day of the year from a TDateTime value + +

+DayOfTheYear returns the number of days that have passed since +the start of the year till the moment indicated by +AValue. This is a one-based number, i.e. January 1 will +return 1. +

+

+For an example, see the function. +

+
+ + + + + + +
@@ -1571,6 +1857,24 @@ returns a TDateTime value with the date of the last day of the year < Calculate the number of hours passed since the start of the year. + +

+HourOfTheYear returns the number of hours that have passed since +the start of the year (January 1, 00:00:00) till the moment indicated by +AValue. This is a zero-based number, i.e. +January 1 00:59:59 will return 0. +

+

+For an example, see the function. +

+
+ + + + + + +
@@ -1586,6 +1890,25 @@ returns a TDateTime value with the date of the last day of the year < Calculate the number of minutes elapsed since the start of the year + +

+MinuteOfTheYear returns the number of minutes that have passed since +the start of the year (January 1, 00:00:00) till the moment indicated by +AValue. This is a zero-based number, i.e. +January 1 00:00:59 will return 0. +

+

+For an example, see the function. +

+
+ + + + + + + +
@@ -1601,6 +1924,25 @@ returns a TDateTime value with the date of the last day of the year < Calculate the number of seconds elapsed since the start of the year. + +

+SecondOfTheYear returns the number of seconds that have passed since +the start of the year (January 1, 00:00:00) till the moment indicated by +AValue. This is a zero-based number, i.e. +January 1 00:00:00.999 will return 0. +

+

+For an example, see the function. +

+
+ + + + + + + +
@@ -1616,6 +1958,25 @@ returns a TDateTime value with the date of the last day of the year < Calculate the number of milliseconds elapsed since the start of the year. + +

+MilliSecondOfTheYear returns the number of milliseconds that have passed since +the start of the year (January 1, 00:00:00.000) till the moment indicated by +AValue. This is a zero-based number, i.e. +January 1 00:00:00.000 will return 0. +

+

+For an example, see the function. +

+
+ + + + + + + +
diff --git a/docs/datutex/README b/docs/datutex/README index ca9c3a529e..378c599231 100644 --- a/docs/datutex/README +++ b/docs/datutex/README @@ -21,3 +21,19 @@ ex21.pp contains an example of the IsSameDay function. ex22.pp contains an example of the PreviousDayOfWeek function. ex23.pp contains an example of the YearOf function. ex24.pp contains an example of the StartOfTheYear function. +ex25.pp contains an example of the EndOfTheYear function. +ex26.pp contains an example of the StartOfAYearfunction. +ex27.pp contains an example of the EndOfAYear function. +ex28.pp contains an example of the StartOfTheMonth function. +ex29.pp contains an example of the EndOfTheMonth function. +ex30.pp contains an example of the StartOfAMonth function. +ex31.pp contains an example of the EndOfAMonth function. +ex32.pp contains an example of the StartOfTheWeek function. +ex33.pp contains an example of the EndOfTheWeek function. +ex34.pp contains an example of the StartOfAWeek function. +ex35.pp contains an example of the EndOfAWeek function. +ex36.pp contains an example of the StartOfTheDay function. +ex37.pp contains an example of the EndOfTheDay function. +ex38.pp contains an example of the StartOfADay function. +ex34.pp contains an example of the EndOfADay function. +ex40.pp contains an example of the WeekOfTheYear function. diff --git a/docs/datutex/ex27.pp b/docs/datutex/ex27.pp index 137848b882..9c74e8db5a 100644 --- a/docs/datutex/ex27.pp +++ b/docs/datutex/ex27.pp @@ -1,4 +1,4 @@ -Program Example25; +Program Example27; { This program demonstrates the EndOfAYear function } diff --git a/docs/datutex/ex28.pp b/docs/datutex/ex28.pp new file mode 100644 index 0000000000..0cb24bb4ba --- /dev/null +++ b/docs/datutex/ex28.pp @@ -0,0 +1,12 @@ +Program Example28; + +{ This program demonstrates the StartOfTheMonth function } + +Uses SysUtils,DateUtils; + +Const + Fmt = '"First day of this month : "dd mmmm yyyy'; + +Begin + Writeln(FormatDateTime(Fmt,StartOfTheMonth(Today))); +End. \ No newline at end of file diff --git a/docs/datutex/ex29.pp b/docs/datutex/ex29.pp new file mode 100644 index 0000000000..4cd25233ca --- /dev/null +++ b/docs/datutex/ex29.pp @@ -0,0 +1,12 @@ +Program Example29; + +{ This program demonstrates the EndOfTheMonth function } + +Uses SysUtils,DateUtils; + +Const + Fmt = '"last day of this month : "dd mmmm yyyy'; + +Begin + Writeln(FormatDateTime(Fmt,EndOfTheMonth(Today))); +End. \ No newline at end of file diff --git a/docs/datutex/ex30.pp b/docs/datutex/ex30.pp new file mode 100644 index 0000000000..a9b75f5bea --- /dev/null +++ b/docs/datutex/ex30.pp @@ -0,0 +1,16 @@ +Program Example30; + +{ This program demonstrates the StartOfAMonth function } + +Uses SysUtils,DateUtils; + +Const + Fmt = '"First day of this month : "dd mmmm yyyy'; +Var + Y,M : Word; + +Begin + Y:=YearOf(Today); + M:=MonthOf(Today); + Writeln(FormatDateTime(Fmt,StartOfAMonth(Y,M))); +End. \ No newline at end of file diff --git a/docs/datutex/ex31.pp b/docs/datutex/ex31.pp new file mode 100644 index 0000000000..be63633f84 --- /dev/null +++ b/docs/datutex/ex31.pp @@ -0,0 +1,16 @@ +Program Example31; + +{ This program demonstrates the EndOfAMonth function } + +Uses SysUtils,DateUtils; + +Const + Fmt = '"Last day of this month : "dd mmmm yyyy'; +Var + Y,M : Word; + +Begin + Y:=YearOf(Today); + M:=MonthOf(Today); + Writeln(FormatDateTime(Fmt,EndOfAMonth(Y,M))); +End. \ No newline at end of file diff --git a/docs/datutex/ex32.pp b/docs/datutex/ex32.pp new file mode 100644 index 0000000000..8eaab142de --- /dev/null +++ b/docs/datutex/ex32.pp @@ -0,0 +1,12 @@ +Program Example32; + +{ This program demonstrates the StartOfTheWeek function } + +Uses SysUtils,DateUtils; + +Const + Fmt = '"First day of this week : "dd mmmm yyyy'; + +Begin + Writeln(FormatDateTime(Fmt,StartOfTheWeek(Today))); +End. \ No newline at end of file diff --git a/docs/datutex/ex33.pp b/docs/datutex/ex33.pp new file mode 100644 index 0000000000..159b344d58 --- /dev/null +++ b/docs/datutex/ex33.pp @@ -0,0 +1,12 @@ +Program Example33; + +{ This program demonstrates the EndOfTheWeek function } + +Uses SysUtils,DateUtils; + +Const + Fmt = '"last day of this week : "dd mmmm yyyy'; + +Begin + Writeln(FormatDateTime(Fmt,EndOfTheWeek(Today))); +End. \ No newline at end of file diff --git a/docs/datutex/ex34.pp b/docs/datutex/ex34.pp new file mode 100644 index 0000000000..6f2a2f9cc7 --- /dev/null +++ b/docs/datutex/ex34.pp @@ -0,0 +1,19 @@ +Program Example34; + +{ This program demonstrates the StartOfAWeek function } + +Uses SysUtils,DateUtils; + +Const + Fmt = '"First day of this week : "dd mmmm yyyy hh:nn:ss'; + Fmt2 = '"Second day of this week : "dd mmmm yyyy hh:nn:ss'; + +Var + Y,W : Word; + +Begin + Y:=YearOf(Today); + W:=WeekOf(Today); + Writeln(FormatDateTime(Fmt,StartOfAWeek(Y,W))); + Writeln(FormatDateTime(Fmt2,StartOfAWeek(Y,W,2))); +End. \ No newline at end of file diff --git a/docs/datutex/ex35.pp b/docs/datutex/ex35.pp new file mode 100644 index 0000000000..801c0faab9 --- /dev/null +++ b/docs/datutex/ex35.pp @@ -0,0 +1,19 @@ +Program Example35; + +{ This program demonstrates the EndOfAWeek function } + +Uses SysUtils,DateUtils; + +Const + Fmt = '"Last day of this week : "dd mmmm yyyy hh:nn:ss'; + Fmt2 = '"Last-1 day of this week : "dd mmmm yyyy hh:nn:ss'; + +Var + Y,W : Word; + +Begin + Y:=YearOf(Today); + W:=WeekOf(Today); + Writeln(FormatDateTime(Fmt,EndOfAWeek(Y,W))); + Writeln(FormatDateTime(Fmt2,EndOfAWeek(Y,W,6))); +End. \ No newline at end of file diff --git a/docs/datutex/ex36.pp b/docs/datutex/ex36.pp new file mode 100644 index 0000000000..1a4c94dd15 --- /dev/null +++ b/docs/datutex/ex36.pp @@ -0,0 +1,13 @@ +Program Example36; + +{ This program demonstrates the StartOfTheDay function } + +Uses SysUtils,DateUtils; + +Const + Fmt = '"Start of the day : "dd mmmm yyyy hh:nn:ss'; + + +Begin + Writeln(FormatDateTime(Fmt,StartOfTheDay(Today))); +End. \ No newline at end of file diff --git a/docs/datutex/ex37.pp b/docs/datutex/ex37.pp new file mode 100644 index 0000000000..d9253976ef --- /dev/null +++ b/docs/datutex/ex37.pp @@ -0,0 +1,13 @@ +Program Example37; + +{ This program demonstrates the EndOfTheDay function } + +Uses SysUtils,DateUtils; + +Const + Fmt = '"End of the day : "dd mmmm yyyy hh:nn:ss'; + + +Begin + Writeln(FormatDateTime(Fmt,EndOfTheDay(Today))); +End. \ No newline at end of file diff --git a/docs/datutex/ex38.pp b/docs/datutex/ex38.pp new file mode 100644 index 0000000000..343e299fb3 --- /dev/null +++ b/docs/datutex/ex38.pp @@ -0,0 +1,20 @@ +Program Example36; + +{ This program demonstrates the StartOfADay function } + +Uses SysUtils,DateUtils; + +Const + Fmt = '"Start of the day : "dd mmmm yyyy hh:nn:ss'; + +Var + Y,M,D : Word; + +Begin + Y:=YearOf(Today); + M:=MonthOf(Today); + D:=DayOf(Today); + Writeln(FormatDateTime(Fmt,StartOfADay(Y,M,D))); + DecodeDateDay(Today,Y,D); + Writeln(FormatDateTime(Fmt,StartOfADay(Y,D))); +End. \ No newline at end of file diff --git a/docs/datutex/ex39.pp b/docs/datutex/ex39.pp new file mode 100644 index 0000000000..b752fae650 --- /dev/null +++ b/docs/datutex/ex39.pp @@ -0,0 +1,20 @@ +Program Example36; + +{ This program demonstrates the EndOfADay function } + +Uses SysUtils,DateUtils; + +Const + Fmt = '"End of the day : "dd mmmm yyyy hh:nn:ss'; + +Var + Y,M,D : Word; + +Begin + Y:=YearOf(Today); + M:=MonthOf(Today); + D:=DayOf(Today); + Writeln(FormatDateTime(Fmt,EndOfADay(Y,M,D))); + DecodeDateDay(Today,Y,D); + Writeln(FormatDateTime(Fmt,EndOfADay(Y,D))); +End. \ No newline at end of file diff --git a/docs/datutex/ex40.pp b/docs/datutex/ex40.pp new file mode 100644 index 0000000000..f54c7b0257 --- /dev/null +++ b/docs/datutex/ex40.pp @@ -0,0 +1,20 @@ +Program Example40; + +{ This program demonstrates the WeekOfTheYear function } + +Uses SysUtils,DateUtils; + +Var + N : TDateTime; + +Begin + N:=Now; + Writeln('Month of the year : ',MonthOfTheYear(N)); + Writeln('Week of the year : ',WeekOfTheYear(N)); + Writeln('Day of the year : ',DayOfTheYear(N)); + Writeln('Hour of the year : ',HourOfTheYear(N)); + Writeln('Minute of the year : ',MinuteOfTheYear(N)); + Writeln('Second of the year : ',SecondOfTheYear(N)); + Writeln('MilliSecond of the year : ', + MilliSecondOfTheYear(N)); +End. \ No newline at end of file