We have attached the SQL server time using the Getdate() function to an application, but we are curious if we can have this displayed in a "ticking" format? Thanks!
What exactly do you mean by 'can [we] have this displayed in a "ticking" format?' Terry Broadbent
"The greatest obstacle to discovery is not ignorance -- it is the illusion of knowledge." - Daniel J Boorstin
Right now I have the server time displayed on the opening of my application. But, I need to have this time increment. Right now it displays the time upon opening, but stays on that time. Thanks!
You'll need to write some code (or find some) in your application language. It is not something you should try do in SQL Server.
What development tool are you using? You may be able to get help with this question in forum for that tool. Terry Broadbent
"The greatest obstacle to discovery is not ignorance -- it is the illusion of knowledge." - Daniel J Boorstin
Here some code you should be able to modify for your needs. It uses the system clock but adjusts the time to match the server time.
Create a label named lblClock on the form.
' create a variable to hold the difference between the server and local PC times
Private TimeInt As Long
Private Sub Form_Activate()
' Set the form time for 1 second
Me.TimerInterval = 1000
' calculate the difference between Server and local PC time
TimeInt = DateDiff("s", Now(), getdateval)
' Initialize the clock
Me!LblClock.Caption = Format(DateAdd("s", TimeInt, Now()), "hh:mm:ss AMPM"
End Sub
Private Sub Form_Timer()
' Set the clock each time the time event fires (1 sec)
Me!LblClock.Caption = Format(DateAdd("s", TimeInt, Now()), "hh:mm:ss AMPM"
End Sub Terry Broadbent
"The greatest obstacle to discovery is not ignorance -- it is the illusion of knowledge." - Daniel J Boorstin
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.