[fpc-pascal] WeekDay outdated?

michael.vancanneyt at wisa.be michael.vancanneyt at wisa.be
Mon Aug 13 13:14:40 CEST 2012



On Mon, 13 Aug 2012, Marco van de Voort wrote:

> 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.



More information about the fpc-pascal mailing list