Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations sizbut on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

System Time 1

Status
Not open for further replies.

mannah07

IS-IT--Management
Dec 23, 2003
18
DE
I want to place the system time on a form. Can someone pls help me with a function?
 
DO (HOME()+"\Samples\Solution\Solution.app")
click Controls, and then Timer

Brian
 
I just want to show the current time and even date on a startup form
 
Copy and paste the clock on the sample onto your form.
 
Or code you own:
1. Add a timer to your form, set INTERVAL to 1000

2. Add a label to your form

3. In the timer event:
thisform.label1.Caption=TRANSFORM(TIME())
 
Baltman
You've made my day. Thank so much
Can you throw more light on the code given
Thanks
 
INTERVAL is how often, in milliseconds, the timer event will fire.

The code that fires is that which resides in the timer event of the timer.

TIME() pulls the current time and TRANSFORM(TIME()) turns the time into a character string, which is accepted by label captions.

thisform.label1.Caption=TRANSFORM(TIME()) assigns the caption of the label dynamically, and since it is in the timer event of the timer, is re-set every 1000 milliseconds (i.e. second).

You can add day etc too:
thisform.label1.Caption=CDOW(DATE())+" "+TRANSFORM(TIME())
 
It also occurs to me that you can do without the label at all by using:
@1,1 say TRANSFORM(TIME())
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top