FoxPro SET HOURS TO Command Only Affects System Clock

ID: Q92361

The information in this article applies to:

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

Last Reviewed: June 27, 1995