Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Retrieving the current date/time from a server
Message
From
11/10/1999 16:36:20
 
 
To
11/10/1999 15:09:01
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00275100
Message ID:
00275149
Views:
22
>Is there a way to get the current date/time from the server where a VFP application is running from? The VFP date(), time(), datetime() functions all return the date/time from the workstation. I need to be able to get the time from the server where the program is running from. I also need to be able to do it for both NT and Novell servers.
>
>Any suggestions would be appreciated.

Here is a program I wrote for this occasion:
#DEFINE _SERVER "svrsbdell1"
#DEFINE _PATH "storage"

function ServerTime( cServerName, cPath )

local cUNC,cTmpFile,tServerTime

if empty( cServerName )
	cServerName = _SERVER
endif
if empty( cPath )
	cPath = _PATH
endif

cTmpFile = '!'+right(SYS(2015),7)+'.tmp'

cUNC = addbs('\\'+cServerName)

if left(cPath,1) = '\'
	cPath = subs(cPath,2)
endif

cUNC = addbs(cUNC+cPath)+cTmpFile

set alternate to ( cUNC )
?
set alternate to

tServerTime = FDATE( cUNC, 1 )

delete file ( cUNC )

return tServerTime
THis actually returns a DateTime... also, the user must have full access to the path you specify for it to work... It uses an 8.3 file name so it will [should] work fine on a Novel Server.

Bob
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform