CToDoW()

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

2 responses to “CToDoW()

  1. Pingback: Harbour Date & Time Functions | Viva Clipper !

  2. Pingback: Harbour All Functions – C | Viva Clipper !

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s