Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Retrieving the current date/time from a server
Message
De
11/10/1999 16:56:22
 
 
À
11/10/1999 16:36:20
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00275100
Message ID:
00275166
Vues:
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


Thanks, I give this a try.
Mark Johns
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform