Solved

Date and Time Stamps

Posted on 2002-06-24
9
130 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
MS Dynamics Made Instantly Simpler

Make Your Microsoft Dynamics Investment Count  & Drastically Decrease Training Time by Providing Intuitive Step-By-Step WalkThru Tutorials.

 
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

SharePoint Admin?

Enable Your Employees To Focus On The Core With Intuitive Onscreen Guidance That is With You At The Moment of Need.

Question has a verified solution.

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

Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses
Course of the Month4 days, 21 hours left to enroll

635 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