Logo

Hacker’s Guide to Visual FoxPro
An irreverent look at how Visual FoxPro really works. Tells you the inside scoop on every command, function, property, event and method of Visual FoxPro.

SET FDOW, SET FWEEK, Set(“FDoW”), Set(“FWeek”)

FDoW sets the first day of the week, used to calculate DOW() (day of week) and WEEK(). FWeek determines how to compute the first week of the year for the WEEK() function.

Usage

SET FDOW TO [ nFirstDayOfWeek ]
nFirstDayOfWeek = SET( "FDOW" )
SET FWEEK TO [ nFirstWeek ]
nFirstWeek = SET( "FWEEK" )

Parameter

Value

Meaning

nFirstDayOfWeek

Omitted or 1

Sunday is the first day of the week.

2 – 7

Use days Monday – Saturday as the first day.

nFirstWeek

Omitted or 1

The week containing January 1 is week 1.

2

The week containing at least four days in the new year is week 1.

3

Week 1 is the first week completely within the new year.

These functions come in handy for calculations involving work scheduling. You’ll want to ensure your application SETs these explicitly in code or the CONFIG.FPW file if you plan to do calculations on these dates, because many manufacturing firms use week numbers as a key part of planning and scheduling.

Example

SET FWEEK to 3  && First week is a full seven days
SET FDOW to 4   && Set the first day to Wednesday

The example above sets the first week of the year to the first week that falls entirely within the new year. FWEEK determines what day the week starts on from the setting of SET FDOW. Executing SET FWEEK overrides a setting previously set on the International tab of the Options screen, or the default read from the Registration Database. The Registry values are only read in the development version of VFP.

See Also

Date(), Day(), DMY(), DoW(), GoMonth(), MDY(), Month(), Set Century, Set Date, Set Mark To, Set FDow, Week(), Year()