Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2012-08

WeekDay outdated?

10 messages · 6 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Jürgen Hestermann
to Daniel Gaspary
Daniel Gaspary wrote 8 lines
On Sun, Aug 12, 2012 at 2:05 PM, Jürgen Hestermann wrote: > I am not able to use this function: > http://www.freepascal.org/docs-html/rtl/dos/weekday.html > nor can I find it in the sources. > Does it still exist? > If yes, how to use it? Which unit? DOS does not work. You will find what you need at unit dateutils.

When I add dateutils to my units Weekday isn't found either (I already tried this yesterday).

Jonas Maebe
to Jürgen Hestermann: I am not able to use this function: http://www.freepascal.org/docs-html/rtl/dos/weekday.ht…

Jürgen Hestermann wrote on Sun, 12 Aug 2012:

Show quoted text 5 lines
I am not able to use this function: http://www.freepascal.org/docs-html/rtl/dos/weekday.html nor can I find it in the sources. Does it still exist? If yes, how to use it? Which unit? DOS does not work.

The weekday function only exists in the unix version of the Dos unit. It should probably either be removed from its interface, or added to the common part of the Dos unit (there's nothing unix-specific about it).

The generic function to calculate the day of the week is http://www.freepascal.org/docs-html/rtl/sysutils/dayofweek.html

Jonas

Howard Page-Clark
to Jürgen Hestermann: When I add dateutils to my units Weekday isn't found either (I already tried this…
Jürgen Hestermann wrote 9 lines
> I am not able to use this function: >> http://www.freepascal.org/docs-html/rtl/dos/weekday.html >> nor can I find it in the sources. >> Does it still exist? >> If yes, how to use it? Which unit? DOS does not work. > You will find what you need at unit dateutils. When I add dateutils to my units Weekday isn't found either (I already tried this yesterday).

Sysutils has an integer DayOfWeek function, and dateutils has a word DayOfTheWeek function.
Both take a TDateTime parameter (rather than the separate year, month, day parameters of the old dos unit).

Howard

Jürgen Hestermann
to Jonas Maebe: Jürgen Hestermann wrote on Sun, 12 Aug 2012: The weekday function only exists in the…
Jonas Maebe wrote
The weekday function only exists in the unix version of the Dos unit.

That's strange (and not documented).

It should probably either be removed from its interface, or added to the common part of the Dos unit (there's nothing unix-specific about it).

It should definitely be added (see below).

The generic function to calculate the day of the week is http://www.freepascal.org/docs-html/rtl/sysutils/dayofweek.html

Yes, but requires an intermediate TDateTime parameter. Weekday would be much easier and direct.

Jürgen Hestermann
to Howard Page-Clark: Sysutils has an integer DayOfWeek function, and dateutils has a word DayOfTheWeek…
Howard Page-Clark wrote
Sysutils has an integer DayOfWeek function, and dateutils has a word DayOfTheWeek function. Both take a TDateTime parameter (rather than the separate year, month, day parameters of the old dos unit).

Yes, I already saw this. But this requires a TDateTIme parameter. I have year, month, day directly available.
Why beeing forced to create a TDateTime parameter? Weekday() would not require this and it is documented but does not exist? Why?

Jonas Maebe
to Jürgen Hestermann: That's strange (and not documented). It should definitely be added (see below). Yes, but…

Jürgen Hestermann wrote on Mon, 13 Aug 2012:

Am 2012-08-13 11:08, schrieb Jonas Maebe: > The weekday function only exists in the unix version of the Dos unit. That's strange (and not documented).

It's because the documentation is generated under Linux using fpdoc (which is the only scenario that is used/tested/supported for generating the documentation), and hence fpdoc sees the RTL as it would be compiled under Linux. It has no idea that a particular function may not be present under other OSes (and generally that simply should not happen for common units, or at least be hidden from fpdoc).

Jonas

Marco van de Voort
to Jonas Maebe: Jürgen Hestermann wrote on Sun, 12 Aug 2012: The weekday function only exists in the…

In our previous episode, Jonas Maebe said:

Show quoted text 10 lines
> I am not able to use this function: > http://www.freepascal.org/docs-html/rtl/dos/weekday.html > nor can I find it in the sources. > Does it still exist? > If yes, how to use it? Which unit? DOS does not work. The weekday function only exists in the unix version of the Dos unit. It should probably either be removed from its interface, or added to the common part of the Dos unit (there's nothing unix-specific about it).

As a first step I added "platform;" modifiers to all unix specific functions in unix' unit dos.

The generic function to calculate the day of the week is http://www.freepascal.org/docs-html/rtl/sysutils/dayofweek.html

IIRC in Delphi dateutils.dayoftheweek is prefered since its introduction in D6 which introduced dateutils and ISO 8601 compatible functions. (the definition of the first day of the week differs from region to region iirc)

But the FPC docs don't mention what the first day of the week is for that function, OR its compliance.

Unknown author
to Marco van de Voort
Marco van de Voort wrote 24 lines
In our previous episode, Jonas Maebe said: >> I am not able to use this function: >> http://www.freepascal.org/docs-html/rtl/dos/weekday.html >> nor can I find it in the sources. >> Does it still exist? >> If yes, how to use it? Which unit? DOS does not work. > > The weekday function only exists in the unix version of the Dos unit. > It should probably either be removed from its interface, or added to > the common part of the Dos unit (there's nothing unix-specific about > it). As a first step I added "platform;" modifiers to all unix specific functions in unix' unit dos. > The generic function to calculate the day of the week is > http://www.freepascal.org/docs-html/rtl/sysutils/dayofweek.html IIRC in Delphi dateutils.dayoftheweek is prefered since its introduction in D6 which introduced dateutils and ISO 8601 compatible functions. (the definition of the first day of the week differs from region to region iirc) But the FPC docs don't mention what the first day of the week is for that function, OR its compliance.

It is monday=1..sunday=7, and the whole unit is supposed to be ISO 8601 compliant.

Michael.