CToMonth()

CToMonth()

Convert name of month to its ordinal number

Syntax

       CToMonth( <cName> ) -> nOrdinal

Argument

<cName> Designates the name of one of the 12 months.

Returns

CToMonth() returns the number for the designated month name.

Description

Use CToMonth() to change the name of a month into a number. January corresponds to 1, February 2, etc.. If the function returns a 0 value, then an invalid parameter has been passed. If you shorten the month name, use explicit abbreviations to return an accurate return value.

Notes

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

Examples

       .  Show the number for January:
              ? CToMonth("January")      // Result: 1
           .  Show several ways to determine the month number for August:
              ? CToMonth("AUGUST")       // Result: 8
              ? CToMonth("August")       // Result: 8
              ? CToMonth("Au")           // Result: 8
           .  The number for April:
              ?CToMonth("A")             // Result: 4

Compliance

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

Platforms

All

Files

Source is dattime2.prg, library is libct.

Seealso

NToCMonth()

Date & Time Functions

Date & Time Functions

ADays Returns an array with the days names
AddMonth Adds or subtracts months to/from a date
AMonths Returns an array with the months names
BOM Beginning date Of Month of given date
BOQ Date of beginning Of quarter containing given date
BOY Date to find first day of year, default is DATE()
CDoW Converts a date to the day of week
CMonth Return the name of the month
CToD Converts a character string to a date expression
CToDoW Convert name of day of the week to its ordinal number
CToMonth Convert name of month to its ordinal number
Date Return the Current OS Date
Day Return the numeric day of the month
Days Convert elapsed seconds into days
DaysInMonth Returns the number of days in month
DaysToMonth Total number of days from first of Jan to beginning of nMonth
DMY Returns the date as a string in DD Month YY format
DoW Value for the day of week
DOY Determines the day of the year for a specific date
DToC Date to character conversion
DToS Date to string conversion
ElapTime Calculates elapted time
EOM End Of Month
EOQ Date of end of quarter
EOY Last date Of Year
IsLeap Tests if a specific year is a leap year
IsLeapYear Checks if the given date is a leap year
LastDayOM Determines the number of days in a month
MDY Returns the date as a string in Month DD, YY or Month DD, YYYY
Month Converts a date expression to a month value
NToCDoW Find day name by num of day
NToCMonth Find a month name by the number of month
Quarter Returns a number equal to the quarter in which a date falls
Seconds Returns the number of elapsed seconds past midnight
Secs Return the number of seconds from the system date
SecToTime Converts seconds into a time string
Time Returns the system time as a string
TimeValid Determines whether a specified time is valid
TimeToSec Calculates the seconds since midnight
WaitPeriod Pauses a specified time in increments of 1/100 seconds
Week Returns the calendar week a number
WOY Gets the week number of the year
Year Converts the year portion of a date into a numeric value

CT_NToCMonth

NToCMonth()
 Changes the number of a month into a month name
------------------------------------------------------------------------------
 Syntax

     NToCMonth(<nMonth>) --> cMonth

 Argument

     <nMonth>  Designates a month number for which a month name is returned.

 Returns

     NToCMonth() returns the name that corresponds to the month number.

 Description

     NToCMonth() determines the month name that corresponds to its month
     number.  January is 1, February is 2, ..., December is 12.  If a number
     outside this range is passed, the function returns a null string as a
     value.

 Note

     The function's operation depends on the country specific adaptation of
     your Clipper compiler.  With an English version of Clipper, only
     English day names are returned.

 Example

     An English Clipper returns:

     ? NToCMonth(1)         //"January"
     ? NToCMonth(2)         //"February"
     ? NToCMonth(12)        //"December"
     ? NToCMonth(14)        //""

See Also: CToMonth()

Tools — Date/Time Functions

Introduction Date/Time Functions
ADDMONTH()   Adds or subtracts months to/from a date
BOM()        Determines the date of the first day of a month
BOQ()        Determines the date for the beginning of a quarter
BOY()        Determines the date for the beginning of a year
CTODOW()     Converts the day of the week name into a corresponding number
CTOMONTH()   Converts the name of the month into a corresponding number
DMY()        Returns a date in "DD Month YY" format
DOY()        Determines the day of the year for a specific date
EOM()        Determines the date for the last day of a month
EOQ()        Determines the date for the end of a quarter
EOY()        Determines the date for the end of the year
ISLEAP()     Tests if a specific year is a leap year
LASTDAYOM()  Determines the number of days in a month
MDY()        Returns a date in the "Month DD, YY" format
NTOCDOW()    Changes the number of a weekday into a weekday name
NTOCMONTH()  Changes the number of a month into a month name
QUARTER()    Determines the quarter in which a specific date lies
SECTOTIME()  Converts seconds into a time string
SETDATE()    Sets the system date
SETTIME()    Sets the system clock
SHOWTIME()   Continuously displays the time at desired screen position
STOD()       Converts an ANSI date string into Clipper format
TIMETOSEC()  Calculates the seconds since midnight
TIMEVALID()  Determines whether a specified time is valid
WAITPERIOD() Pauses a specified time in increments of 1/100 seconds
WEEK()       Returns the calendar week for a date
WOM()        Returns the week within a month.