FoxPro SET HOURS TO Command Only Affects System Clock

Last reviewed: June 27, 1995
Article ID: Q92361
The information in this article applies to:
  • Microsoft FoxPro for MS-DOS, versions 1.0, 1.01, 1.02, 2.0, 2.5, and 2.50a
  • Microsoft FoxPro for Windows, versions 2.5 and 2.5a

SUMMARY

The SET HOURS TO command changes only the system clock. This command does not affect the results of the TIME() function. The clock shows A.M. or P.M. when Hours is set to 12. The TIME() function always returns the system time in 24-hour format.

MORE INFORMATION

Use the following code to demonstrate the results of the SET HOURS TO command:

   set hours to 12
   set clock on             && Clock in 12-hour format.
   ? time()                 && Time() returned in 24-hour format.
   set hours to 24          && Clock turns to 24-hour format.

The clock changes only when the time is later than 12 P.M.

Use the code below to format the system time in 12-hour format:

   set talk off
   x=0
   y=0
   z=0
   x=int(val(substr(time(),1,2)))
   y=substr(time(),3,6)
   ?iif(x>12,str(z)+y+"pm",time())


Additional reference words: FoxDos FoxWin 1.00 1.x 2.00 2.50 2.x 2.50a
KBCategory: kbprg
KBSubcategory: FxprgGeneral


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: June 27, 1995
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.