?
Solved

Date and Time Stamps

Posted on 2002-06-24
9
Medium Priority
?
131 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
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
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 80 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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
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 Month17 days, 10 hours left to enroll

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