JavaScript Editor js editor     Web development 

Main Page

File: ...\Samples\Solution\Controls\Timer\Clock.scx

This sample contains the Clock custom control in Samples.vcx on a form. The class includes a text box for displaying the date and time and a timer for updating the display.

The TimeFormat property of the clock class can be set to 0 for 24-hour time format or 1 for 12-hour format. The code in the Timer event of the timer updates the time.

В Copy Code

IF This.Parent.TimeFormat = 0
   This.Parent.txtTime.Value = IIF(VAL(SUBSTR(TIME(),1,2))>12, ;
   This.Parent.txtTime.Value = TIME()

THIS.Parent.txtDate.Value = LONGDATE_LOC

This class contains a separate text box for date and time values. If you want to hide one or the other, you can easily set its Visible property to false (.F.). An easier way to display the time and date is to use a single text box and set the value of this text box in a timer control to DATETIME(В ). This will make it possible for you to take advantage of the Hours, Seconds, and DateFormat properties of a text box.

See Also

JavaScript Editor js editor     Web development