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

Need to get date from server instead of client 1

Status
Not open for further replies.

Prattdakota

Vendor
Jan 10, 2003
38
0
0
US
I have a number of users accessing a database which resides on a network server. The problem is that their system dates are not always reliable and I need to be able to pull the system date from the server on which the database resides. This is not an SQL server so the GetDate() function explained in other posts is not available to me.

Any suggestions would be appreciated.
 
I don't know of any good method, I suppose there should be some, but what I've done a couple of times when I've had the need for server date/time, is the following:

Since one need permissions on the server anyway, I just created a text file, using a name derived from user name and local time, to avoid concurrency issues, then reading the last modified date of that file, and finally deleting it.

Here's a very short snippet illustrating the method:

[tt]dim fs as scripting.filesystemobject
dim strfilename as string
strfilename = "f:\db\mytest.txt"
set fs=createobject("scripting.filesystemobject")
fs.createtextfile strfilename, true
debug.print fs.getfile(strfilename).datelastmodified[/tt]

- typed not tested, requeires a reference to Microsoft Scripting Runtime (in VBE - Tools | References)

Roy-Vidar
 
Roy - Thanks very much for your input. I'll give that a try and see if I can get it to work in my app.
 
Roy - Sorry for not getting back to you on this previously. I added the code and tested at my client's site earlier this week. It worked like magic. Great solution. You get a belated star from me. Thanks again.
 
While some may complain, it is generally the DUTY of the net Cops to set up the system such that the local systems are (tiime) sysnced to the server. For actually local machines, there are a number of available (network) utility packages which work well for this. I understand that for the far afield folks there are some additional issues (dratted time zones!!), but the proficient Net COp CAN work this out.

You should pester the net cops and their bosses (yes, Dorothy they DO have "Bosses"!!!) until a real soloution is presented.

While I'm in the grousing about the Net Cops mode, you need to be particularly aware of and careful about the policies and procedures (MACHINE onesd) regarding back up of what ever. Most (all?) the commercial back-up processes rely on WIN (?) services. Mostly, htese do not allow copying of files with open handles (instances). Net Cops must be INSTRUCTED to boot users in the dark of the night to do the back ups, otherwise what ever they (the users) have open usually doesn't get copied. When it erupts (and it WILL erupt) you the db 'guru' will bear the brunt of the pain shared around the water cooler.



MichaelRed


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top