Hackers Guide to Visual FoxPro 7.0
Set SysFormats, Set("SysFormats")
This command yields the control of the date and time formats from the developer to the end user, a goal we find laudable.| Usage | SET SYSFORMATS ON | OFF cOnOrOff = SET( "SYSFORMATS" ) |
| | Help states that when SYSFORMATS is set on, you can use the following SET commands to override the Windows settings: SET CENTURY, SET CURRENCY, SET DATE , SET DECIMALS, SET HOURS, SET MARK TO, SET POINT, and SET SEPARATOR. Well, most work as you'd expect: After you SET SYSFORMATS ON, if you issue a SET command to override a setting, the data displays with the overridden format and the corresponding SET() function returns the overridden value (the one you just set it to). Not so with SET CENTURY and SET MARK. They properly pick up the Windows settings when SYSFORMAT is set ON. However, issuing a SET CENTURY or SET MARK does not override the formatting in SYSFORMATS, but the SYS() function returns a value that claims it does. |
But it's very challenging to work in a system where you cannot determine the current settings. Generic date-parsing routines will have to be revised to more carefully manipulate the date setting, not to depend on switching and restoring SET DATE. (Hint: If the setting of SYSFORMATS is ON and the DATE is SET to SHORT, you need to preserve and restore SET MARK TO and/or turn on and off SYSFORMATS to parse the date.) Routines to automatically size a text box to fit the date cannot depend on SET("CENTURY"). A routine that sets data session-scoped commands (as all of these are) to the default data session settings cannot always determine what these commands are set to. This command is a good idea; we'll be pleased when tCENTURY and MARK are as functional as the rest.
| Example | SET SYSFORMATS ON * In the Control Panel, set the short date to 'M/d/yy' SET CENTURY ON ? SET("CENTURY") && "ON" ? DATE() && Yields a date in MM/DD/YY format. |
| See Also | Set Century, Set Date, Set Hour, Set Mark To, Set Seconds |
View Updates
Copyright © 2002 by Tamar E. Granor, Ted Roche, Doug Hennig, and Della Martin. All Rights Reserved.
Категории