Viva Clipper !

CToDoW()

Advertisements

CToDoW()

Convert name of day of the week to its ordinal number

Syntax

       CToDoW( <cDayName> ) -> <nOrdinal>

Argument

<cDayName> Name of day to convert to ordinal number

Return

<nOrdinal> Ordinal number of <cDayName>

Description

Use CToDoW() to change the name of a day of the week to a number. Sunday corresponds to 1, Monday 2, etc.. If the function returns a 0 value, an invalid parameter has been passed. You can shorten the day names, but these abbreviations must be explicit to return an accurate value.

Notes

. Uppercase and lowercase letters do not affect the name of the day of the week. . The function’s operation depends on the country-specific adaptation of your CA-Clipper compiler. With an English version of CA-Clipper, only English day names are recognized.

Example

       PROC MAIN()
          SETMODE( 25, 80 )
          CLS
          SET DATE GERM
          SET CENT ON
          ? "CToDoW('Sunday') :", CToDoW('Sunday') // 1
          *  Show several ways to get the day of
          *  the week for Wednesday:
          ? "CToDoW('WEDNESDAY') :", CToDoW('WEDNESDAY')      // 4
          ? "CToDoW('Wednesday') :", CToDoW('Wednesday')      // 4
          ? "CToDoW('Wed') :",CToDoW('Wed')                   //  4
          *  What number of the day of the week is Monday?
          ? "CToDoW( 'M' ) :", CToDoW( 'M' ) //  2
          ?
          WAIT "EOF CTODOW.prg"
       RETURN // MAIN

Compliance

CToDoW() is compatible with CT3’s CToDoW().

Platforms

All

Files

Source is dattime2.prg, library is libct.

Seealso

NToCDoW()

Advertisements

Advertisements