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 SECONDS, Set(“Seconds”), Seconds

This setting and property determine whether datetime output includes the seconds portion of the time. The function returns the current setting.

Usage

SET SECONDS ON | OFF
cOnOrOff = SET( "SECONDS" )
txtTextbox.Seconds = nSecondsSetting
nSecondsSetting = txtTextbox.Seconds

Parameter

Value

Meaning

nSecondsSetting

0

Don't show seconds.

1

Show seconds.

2

Use SET SECONDS setting.

As in so many places in VFP, the SET command here is global (actually, data session wide), while the property is local.

SET SECONDS also affects conversion of datetimes with TToC(). When SECONDS is OFF, the converted value doesn’t include the seconds portion. This setting doesn’t affect precision going the other direction, though. CTOT(“12/31/1999 23:59:59”) always stores the seconds internally, regardless of the SECONDS setting.

Example

SET SECONDS ON    && Default value
? DATETIME()      && Displays 09/15/95 04:30:21 PM
SET SECONDS OFF
? DATETIME()      && Displays 09/15/95 04:30 PM

This.Seconds = 1  && Turn on seconds in text box code

See Also

DateTime(), Hours, Set Hours, TToC()