Date and Time Stamps

If an exe on a client PC writes a file to the server where will the date be taken from, the server clock or the client clock?
rhubarbtwoAsked:
Who is Participating?
 
bobbit31Commented:
the file creation date is given by the operating system of the computer you write the file to...

if you write the file to your local disk and then copy it to the server, it'll take the client date/time.  If you write the file directly to the server, it will take the server date/time.  Try it out if you don't believe me.
0
 
bobbit31Commented:
the client clock
0
 
bobbit31Commented:
err. which date? the date the file was created? or a date w/in the file?

if the first, then the server
if the latter, then the client
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

 
rhubarbtwoAuthor Commented:
The file creation date
0
 
bobbit31Commented:
file creation date will be time on server
0
 
priya_pbkCommented:
if you use "Now" in your sql query in your appln which is running on the client pc, then it will take the client pc's datetime
eg:
sql="Update tableName set MydateTime='" & Now & "'"

But you can use "getdate" instead of "Now". So that the query takes in the datetime of the server(ie yr database server) even though if you run the appln on the client pc.
Like this..
sql="update tableName set MydateTime=getDate()"


Hope this info helps!

-priya


 
0
 
priya_pbkCommented:
you can also retreive the date of the server like this:
sql="select getdate()"

The above query returns the datetime of the database server

I think if you are writing to a file,using a fso or whatever, it will take the "client pc's datetime."

You can decide which you wish to choose and manipulate/use that date.

-priya


0
 
rhubarbtwoAuthor Commented:
>file creation date will be time on server

>I think if you are writing to a file,using a fso or whatever, it will take the "client pc's datetime."

If a file is written to the server by the client PC (using eg fso or 'open file') then there seems to be a difference of opinion as to which date is used?
0
 
priya_pbkCommented:
what is the type of file that you are writing to the server. I mean is it a text file or what?

>>If a file is written to the server by the client PC (using eg fso or 'open file') then there seems to be a difference of opinion as to which date is used?

Does'nt it depend what time you are writing to the file.

'Try this..

Open a form and add 2 command buttons and give a reference to Microsoft ActiveX Data Objects and write the following in the code window
--------------------------------------------
Dim con As New ADODB.Connection
Dim rs As New ADODB.Recordset
Private Sub cmdServer_Click()

con.Open "Provider=SQLOLEDB.1;Persist Security Info=False;User ID=sa;Initial Catalog=projectDB;Data Source=MyDatabaseName"
rs.CursorLocation = adUseClient
rs.Open "Select getDate()", con, adOpenDynamic, adLockOptimistic
'this will return the database server time

MsgBox rs.Fields(0).Value
TimeToInsert=rs.Fields(0).Value
End Sub

Private Sub cmdClient_Click()
'this will return your/client PC's system time
MsgBox Now
TimeToInsert=Now
End Sub


'----------------------------------------

Now you can use whichever datetime you want. Try changing the server time 2 mts ahead, to check your code. But dont forget to change it back.

I hope this helps.

-priya
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.