Solved

Date and Time Stamps

Posted on 2002-06-24
9
129 Views
Last Modified: 2010-05-02
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?
0
Comment
Question by:rhubarbtwo
  • 4
  • 3
  • 2
9 Comments
 
LVL 18

Expert Comment

by:bobbit31
ID: 7104596
the client clock
0
 
LVL 18

Expert Comment

by:bobbit31
ID: 7104602
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
 

Author Comment

by:rhubarbtwo
ID: 7105024
The file creation date
0
Active Directory Webinar

We all know we need to protect and secure our privileges, but where to start? Join Experts Exchange and ManageEngine on Tuesday, April 11, 2017 10:00 AM PDT to learn how to track and secure privileged users in Active Directory.

 
LVL 18

Expert Comment

by:bobbit31
ID: 7105030
file creation date will be time on server
0
 
LVL 2

Expert Comment

by:priya_pbk
ID: 7106583
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
 
LVL 2

Expert Comment

by:priya_pbk
ID: 7106594
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
 

Author Comment

by:rhubarbtwo
ID: 7113234
>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
 
LVL 2

Expert Comment

by:priya_pbk
ID: 7113339
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
 
LVL 18

Accepted Solution

by:
bobbit31 earned 20 total points
ID: 7113759
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

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction I needed to skip over some file processing within a For...Next loop in some old production code and wished that VB (classic) had a statement that would drop down to the end of the current iteration, bypassing the statements that were c…
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

830 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question