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.
Mailing lists / fpc-pascal / 2012-08
WeekDay outdated?
10 messages · 6 people · –
- JJürgen Hestermann 4
- JJonas Maebe 2
- DDaniel Gaspary 1
- HHoward Page-Clark 1
- MMarco van de Voort 1
- UUnknown author 1
Reply by email Subscribe to this list Your subscription
Read-only archive. Use j and k to move between messages.
Jürgen Hestermann wrote 5 lines
You will find what you need at unit dateutils.
Daniel Gaspary wrote 8 lines
When I add dateutils to my units Weekday isn't found either (I already tried this yesterday).
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
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
When I add dateutils to my units Weekday isn't found either (I already tried this…
Jürgen Hestermann wrote 9 lines
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 wrote on Sun, 12 Aug 2012: The weekday function only exists in the…
Jonas Maebe wroteThe 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.
Sysutils has an integer DayOfWeek function, and dateutils has a word DayOfTheWeek…
Howard Page-Clark wroteSysutils 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?
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
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
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.
Marco van de Voort wrote 24 lines
It is monday=1..sunday=7, and the whole unit is supposed to be ISO 8601 compliant.
Michael.
