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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How does one capture server time from a desktop?

Status
Not open for further replies.

baseballgem

Programmer
Oct 3, 2001
54
US
I suppose if my entire application resided on the f: drive then when a function such as TIME() was called, it would return the time on the F: drive. However in my particular case the application is running on desktop for speed considerations and for times when lap tops with the local app log in.

Thus, how can a desktop capture the server time() i.e. point to a particular drive and return the time on that drive.
I use VFP7.

Since the servers are SQL, I thought I could use something like SQLEXEC and say 'select time() as stime from <anything> ' into a cursor etc. I though I could read the cursor and voila - that's the time. But if failed. The syntax works in VFP but fails in SQLEXEC. Thus, what's the SQL syntax/statement for time() as a field. Datetime() didn't seem to work.

If there is a simpler way to get server time. I'd be interested. Remember all VFP application executables are launched from a user desktop or laptop connetced to a server. Time() function always seems to return time on the c: drive.
 
I think you'll need to use the SQL function GETDATE()

Code:
lnHand = sqlconnect()
lcSQL = &quot;select TheTimeIs=GetDate()&quot;
sqlexec(lnHand, lcSQL, 'OnTheServer')
? OnTheServer.TheTimeIs
sqldisconnect(lnHand)

Andrew Coates
OzFox 2003 Australia's VFP Conference -- ------
DISCLOSURE
We are the Australasian Distributor for the Hentzenwerke Series of Books. (By the same token, I really do think they're the best printed VFP resource out there -- that's why we sell them)
 
Ah yes, I should also mention that you can fcreate() a file and then use ftime() to get the creation time
Code:
lcFileName = &quot;\\civilserver\word_doc\&quot; + sys(2015) + &quot;.tmp&quot;
strtofile('',lcFileName)
if file(lcFileName)
  ltServerTime = ftime(lcFileName)
  erase(lcFileName)
else
  ltServerTime = dtot({})
endif
? ltServerTime



Andrew Coates
OzFox 2003 Australia's VFP Conference -- ------
DISCLOSURE
We are the Australasian Distributor for the Hentzenwerke Series of Books. (By the same token, I really do think they're the best printed VFP resource out there -- that's why we sell them)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top