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

Month()

MONTH()

Converts a date expression to a month value

Syntax

      MONTH(<dDate>) --> nMonth

Arguments

<dDate> Any valid date expression

Returns

<nMonth> Corresponding number of the month in the year, ranging from 0 to 12

Description

This function returns a number that represents the month of a given date expression <dDate>. If a NULL date (CTOD(”)) is passed to the function, the value of the function will be 0.

Examples

      ? Month( Date() )

Compliance

Clipper

Platforms

All

Files

Library is rtl

Seealso

CDOW(), DOW(), YEAR(), CMONTH()

CMonth()

 

CMONTH()

Return the name of the month.

Syntax

      CMONTH(<dDate>)  --> cMonth

Arguments

<dDate> Any date expression.

Returns

<cMonth> The current month name

Description

This function returns the name of the month (January, February, etc.) from a date expression <dDate> passed to it. If a NULL date is passed to the function, the value of the function will be a NULL byte.

Examples

      ? CMonth( Date() )
      IF CMonth( Date() + 10 ) =="March"
         ? "Have you done your system BACKUP?"
      ENDIF

Compliance

Clipper

Platforms

All

Files

Library is rtl

Seealso

CDOW(), DATE(), MONTH(), YEAR(), DOW(), DTOC()

SP_POPVYEAR

POPVYEAR()

  Short:
  ------
  POPVYEAR() Pops up a picklist of virtual years

  Returns:
  --------
  <nSelected> => selected year

  Syntax:
  -------
  POPVYEAR([cTitle])

  Description:
  ------------
  Pops up a virtual picklist of years, beginning with
  the current year. As user scrolls down, year increases. As user
  scrolls up, year decreases. Home key returns to the starting
  year.

  [cTitle]  is a popup box title, none by default

  Examples:
  ---------
   nYear := POPVYEAR("Pick a Year")

  Source:
  -------
  S_DPOPS.PRG

 

SP_BOYEAR

BOYEAR()

  Short:
  ------
  BOYEAR() Determine beginning of year a date falls in

  Returns:
  --------
  <dReturn> => Date of the beginning of the year

  Syntax:
  -------
  BOYEAR([dTarget])

  Description:
  ------------
  Determines beginning of the year of a date and
  returns it as <dReturn>. [dTarget] a date variable. Default is
  DATE()

  Examples:
  ---------
   dBegyear := BOYEAR(date())

  Source:
  -------
  S_BOYEAR.PRG

 

C5_YEAR

 YEAR()
 Convert a date value to the year as a numeric value
------------------------------------------------------------------------------
 Syntax

     YEAR(<dDate>) --> nYear

 Arguments

     <dDate> is the date value to be converted.

 Returns

     YEAR() returns the year of the specified date value including the
     century digits as a four-digit numeric value.  The value returned is not
     affected by the current DATE or CENTURY format.  Specifying a null date
     (CTOD("")) returns zero.

 Description

     YEAR() is a date conversion function that converts a date value to a
     numeric year value.  Use it in calculations for things like periodic
     reports or for formatting date displays.

     YEAR() is a member of a group of functions that return components of a
     date value as numeric values.  The group includes DAY() and MONTH()
     which return the day and month values as numeric values.

 Examples

     .  These examples illustrate YEAR() using the system date:

        ? DATE()                    // Result: 09/20/90
        ? YEAR(DATE())              // Result: 1990
        ? YEAR(DATE()) + 11         // Result: 2001

     .  This example creates a user-defined function using YEAR() to
        format a date value in the following form: month day, year.

        ? Mdy(DATE())               // Result: September 20, 1990

        FUNCTION Mdy( dDate )
           RETURN CMONTH(dDate) + " " + ;
                 LTRIM(STR(DAY(dDate)));
              + "," + STR(YEAR(dDate))

 Files   Library is CLIPPER.LIB.


See Also:
 MONTH() DAY()