Week()

Week()

Returns the calendar week a number

Syntax

      Week( [<dDate>][, <lSWN>] ) -> nWeek

Argument

<dDate> Designates a date for which the week it lies in, is determined. The default is the system date.

<lSWN> Simple Week Number ( see below description )

Returns

WEEK() returns a sequential week number that designates in which week of the year <dDate> lies.

Description

Week() returns the calendar week a number. If no date is specified, the system date is used. An empty date via hb_SToD(“”) returns 0. The week of the year in which a day lies is information required by a number of technical financial calculations or wage accounting. This function determines this week and acknowledged all calendar rules. If <lSWN> is .T., Week() will calculate the “simple week number”, defined by – week #1 starts on January, 1st – week #(n+1) starts seven days after start of week #n If <lSWN> is .F. (default), the ISO8601 week number, defined by – weeks start on mondays – week #1 is the one that includes January, 4 will be calculated.

Note

. When no date is specified, then WEEK() uses the system date. An empty date leads to a 0 result.

Example

       Determine the week for a date:
       dDate  :=  CTOD("03/14/92")
       ? "This date is in week:  ", WEEK(dDate)

Compliance

Week() is compatible with CT3’s Week(). <lSWN> is Harbour extention.

Platforms

All

Files

Source is dattime2.prg, library is libct.

Seealso

CDoW(), CToDoW(), DoW()

Advertisements

Harbour All Functions – D

Date()
Day()
Days()

DaysInMonth()
DaysToMonth()

dbAppend()
dbClearFilter()
dbCloseAll()
dbCloseArea()
dbCommit()
dbCommitAll()
dbCreate()
dbDelete()
dbEval()
dbF()
dbFilter()
dbGoBottom()
dbGoTo()
dbGoTop()
dbReCall()
dbRLock()
dbRLockList()
dbRUnlock()
dbSeek()
dbSelectArea()
dbSetDriver()
dbSetFilter()
dbSkip()
dbSkipper()
dbStruct()
dbUnlock()
dbUnlockAll()
dbUseArea()

DecToBin()
DecToHexa()
DecToOctal()

Deleted()
Descend()
DevOutPict()
DirChange()
DirRemove()
DiskSpace()

DMY()
Do()
DoW()

DOY
DToC()

DToR
DToS()

Harbour 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()

CDoW()

 

CDOW()

Converts a date to the day of week

Syntax

      CDOW(<dDate>)  --> cDay

Arguments

<dDate> Any date expression.

Returns

<cDay> The current day of week.

Description

This function returns a character string of the day of the week, 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

      ? CDOW( Date() )
      IF CDOW( Date() + 10 ) == "Sunday"
         ? "This is a sunny day."
      ENDIF

Compliance

Clipper

Platforms

All

Files

Library is rtl

Seealso

DAY(), DOW(), DATE(), CMONTH()

C5_DOW

 DOW()
 Convert a date value to a numeric day of the week
------------------------------------------------------------------------------
 Syntax

     DOW(<dDate>) --> nDay

 Arguments

     <dDate> is a date value to convert.

 Returns

     DOW() returns the day of the week as a number between zero and seven.
     The first day of the week is one (Sunday) and the last day is seven
     (Saturday).  If <dDate> is empty, DOW() returns zero.

 Description

     DOW() is a date conversion function that converts a date value to a
     number identifying the day of the week.  It is useful when you want date
     calculations on a weekly basis.  DOW() is similar to CDOW(), which
     returns the day of week as a character string instead of a number.

 Examples

     .  These examples illustrate CDOW() and its relationship to
        DOW():

        ? DATE()                        // Result: 09/01/89
        ? DOW(DATE())                  // Result: 3
        ? CDOW(DATE())                  // Result: Tuesday
        ? DOW(DATE() - 2)               // Result: 1
        ? CDOW(DATE() - 2)            // Result: Sunday

     .  This is a user-defined function that uses DOW() to calculate
        the date of last Monday from any other date:

        FUNCTION LastMonday(dDate)
           RETURN (dDate - DOW(dDate) + 2)

 Files   Library is CLIPPER.LIB.

See Also: CDOW() DATE() DAY()