By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,853 Members | 941 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,853 IT Pros & Developers. It's quick & easy.

Managing files by Create time/date

P: n/a
I would like to use the timestamp on files to manage the
currency of support files for my VB windows application.
In this case I would only put the timestamp of the file
in the management database and not the file itself.

To do this I will need to have a File class property for
Create time and date that will let me "set" the Create
time and date of the file to my own chooseing.

The VB file class does not appear to have the ability
to "set" the Create time and date. It can only read it.

Is there another system class that will allow me to set
the Create Time and date of a file?
Nov 20 '05 #1
Share this Question
Share on Google+
9 Replies


P: n/a
> To do this I will need to have a File class property for
Create time and date that will let me "set" the Create
time and date of the file to my own chooseing.
The VB file class does not appear to have the ability
to "set" the Create time and date. It can only read it.


ms-help://MS.VSCC.2003/MS.MSDNQTR.2003APR.1033

Try
Dim path As String = "c:\Temp\MyTest.txt"

If File.Exists(path) = False Then
File.Create(path)
Else
' Take an action that will affect the write time.
File.SetLastWriteTime(path, New DateTime(1985, 4, 3))
End If

' Get the creation time of a well-known directory.
Dim dt As DateTime = File.GetLastWriteTime(path)
Console.WriteLine("The last write time for this file was {0}.",
dt)

' Update the last write time.
File.SetLastWriteTime(path, DateTime.Now)
dt = File.GetLastWriteTime(path)
Console.WriteLine("The last write time for this file was {0}.",
dt)

Catch e As Exception
Console.WriteLine("The process failed: {0}", e.ToString())
End Try

Nov 20 '05 #2

P: n/a
How do I reconcile the fact that the user's computer
regional setting for date might be set to
31/2/1959 11:59:59 PM

But Access has the date stored as
2/31/1959 11:59:59 PM

Are they really the same standard format beneath the
covers??

I know this has got to be a old question...but it is a
first time for me.
Nov 20 '05 #3

P: n/a
> How do I reconcile the fact that the user's computer
regional setting for date might be set to
31/2/1959 11:59:59 PM

But Access has the date stored as
2/31/1959 11:59:59 PM

Are they really the same standard format beneath the
covers??


Hi Bob,

No that would not be the case.

What I do when working with SQL is get the time of the SQL Server it is
pulling info from in order to be indpependant of the users clock. In your
case I would find some outside source that you could access that will give
you a time (another server on the internet etc) to compare.
Nov 20 '05 #4

P: n/a
I believe you are looking for the FileInfo class:

http://msdn.microsoft.com/library/de...mberstopic.asp

--
Mike

Mike McIntyre
Visual Basic MVP
www.getdotnetcode.com
"Bob Achgill" <an*******@discussions.microsoft.com> wrote in message
news:17*****************************@phx.gbl...
I would like to use the timestamp on files to manage the
currency of support files for my VB windows application.
In this case I would only put the timestamp of the file
in the management database and not the file itself.

To do this I will need to have a File class property for
Create time and date that will let me "set" the Create
time and date of the file to my own chooseing.

The VB file class does not appear to have the ability
to "set" the Create time and date. It can only read it.

Is there another system class that will allow me to set
the Create Time and date of a file?

Nov 20 '05 #5

P: n/a
My question is about the order of the time/date pieces...

On one users computer he may have set his month to be
first and the day second

But in my Access data base I have the reversed...

so when I try to use the file info to check the Create
time or set the Create time I am apples and oranges
different between how the data base is talking time and
date and the Access data base is talking time and date.

Does it matter that the user has a different regional
setting for the order of time and date? Is that just
formatting as it appears to the eye of the user AND
beneath the covers the time and date appear the same
between the Access data base and the Windows operating
system??
-----Original Message-----
How do I reconcile the fact that the user's computer
regional setting for date might be set to
31/2/1959 11:59:59 PM

But Access has the date stored as
2/31/1959 11:59:59 PM

Are they really the same standard format beneath the
covers??
Hi Bob,

No that would not be the case.

What I do when working with SQL is get the time of the

SQL Server it ispulling info from in order to be indpependant of the users clock. In yourcase I would find some outside source that you could access that will giveyou a time (another server on the internet etc) to compare.

.

Nov 20 '05 #6

P: n/a
Bob,

Time formats do matter. If you have a different date formats you will need
to create code that can convert between any of the time formats used in your
update process. This conversion code will be used anywhere you need to
create, stamp, read, and compare dates coming from and going to different
formats.

Regional time differences must be considered. One approach to dealing with
time stamps accross time regions is to use coordinated universal time (UTC).
UTC can be used convert time on the server and time from a remote client to
UTC so you can make an apples to apples comparrison.

To update the user - are you pushing table rows to a table in a remote
user's copy of the Access database you have on the server? Or are you
pushing a new database (mdb) to them? If neither of these questions is true
what type of file are you keeping up on the remote client?

I ask because there are other approaches to keeping the remote client in
sync that do not involve working with a file's DateTime. I may be able to
provide directions for a simpler and more stable approach.
--
Mike

Mike McIntyre
Visual Basic MVP
www.getdotnetcode.com

"Bob Achgill" <an*******@discussions.microsoft.com> wrote in message
news:17*****************************@phx.gbl...
My question is about the order of the time/date pieces...

On one users computer he may have set his month to be
first and the day second

But in my Access data base I have the reversed...

so when I try to use the file info to check the Create
time or set the Create time I am apples and oranges
different between how the data base is talking time and
date and the Access data base is talking time and date.

Does it matter that the user has a different regional
setting for the order of time and date? Is that just
formatting as it appears to the eye of the user AND
beneath the covers the time and date appear the same
between the Access data base and the Windows operating
system??
-----Original Message-----
How do I reconcile the fact that the user's computer
regional setting for date might be set to
31/2/1959 11:59:59 PM

But Access has the date stored as
2/31/1959 11:59:59 PM

Are they really the same standard format beneath the
covers??


Hi Bob,

No that would not be the case.

What I do when working with SQL is get the time of the

SQL Server it is
pulling info from in order to be indpependant of the

users clock. In your
case I would find some outside source that you could

access that will give
you a time (another server on the internet etc) to

compare.


.

Nov 20 '05 #7

P: n/a
Hi Mike,

Thank you for your advice.

We are making a free program that will run on Pentium 1
class computer with 16MB video card.

It will help illiterate people to learn to read their
native language.

The reading program is in VB .Net

As the student reads text in a WebBrowser window with in
the VB program it looks in the local database for each
word meaning and shows the associated Flash animation for
that word meaning to help the student understand the
meaning of the word. We also show an associated 3D
animation of the hand sign for that word meaning. We
pass this info from the VB .Net program to our C++
program that shows the hand sign.

Our users (in a 3rd world country) will probably
initially have someone hand them a CD that has the
starting programs+mdb+animation files for the language
they are working on learning to read. Let's say one
language will be about
1,800 - Flash animations ( 5 - 30 K each)
1,800 - 3D vector sign files (1-3K each)
mdb - with lexicon and pointers to Flash and sign
files (1MB)

As you can imagine such a system will have a lot of
updates as volunteers add or revise new animations and
hand signs. So we will give the capability to "phone
home" and receive updates if the user has internet
access.

We can use either use pulling rows from a server as an
option to do this and or FTP. The files could either be
packed in the rows and unpacked or straight FTP to the
client disk. If they are straight FTP then hence I need
to have Create Time stamps to determine version of the
files to be replaced on the client machine. If we go the
row transfer method for moving the files then I don't
need to rely on file time stamps.

Any advice on how to make this simpler is much
appreciated!

Bob
-----Original Message-----
Bob,

Time formats do matter. If you have a different date formats you will needto create code that can convert between any of the time formats used in yourupdate process. This conversion code will be used anywhere you need tocreate, stamp, read, and compare dates coming from and going to differentformats.

Regional time differences must be considered. One approach to dealing withtime stamps accross time regions is to use coordinated universal time (UTC).UTC can be used convert time on the server and time from a remote client toUTC so you can make an apples to apples comparrison.

To update the user - are you pushing table rows to a table in a remoteuser's copy of the Access database you have on the server? Or are youpushing a new database (mdb) to them? If neither of these questions is truewhat type of file are you keeping up on the remote client?
I ask because there are other approaches to keeping the remote client insync that do not involve working with a file's DateTime. I may be able toprovide directions for a simpler and more stable approach.

--
Mike

Mike McIntyre
Visual Basic MVP
www.getdotnetcode.com

"Bob Achgill" <an*******@discussions.microsoft.com> wrote in messagenews:17*****************************@phx.gbl...
My question is about the order of the time/date pieces...
On one users computer he may have set his month to be
first and the day second

But in my Access data base I have the reversed...

so when I try to use the file info to check the Create
time or set the Create time I am apples and oranges
different between how the data base is talking time and
date and the Access data base is talking time and date.

Does it matter that the user has a different regional
setting for the order of time and date? Is that just
formatting as it appears to the eye of the user AND
beneath the covers the time and date appear the same
between the Access data base and the Windows operating
system??
>-----Original Message-----
>> How do I reconcile the fact that the user's computer
>> regional setting for date might be set to
>> 31/2/1959 11:59:59 PM
>>
>> But Access has the date stored as
>> 2/31/1959 11:59:59 PM
>>
>> Are they really the same standard format beneath the
>> covers??
>
>Hi Bob,
>
>No that would not be the case.
>
>What I do when working with SQL is get the time of the

SQL Server it is
>pulling info from in order to be indpependant of the

users clock. In your
>case I would find some outside source that you could

access that will give
>you a time (another server on the internet etc) to

compare.
>
>
>.
>

.

Nov 20 '05 #8

P: n/a
Bob,

If you wish I am willing to donate some free time to help you work up the
best synchronization approach for this project.

By taking the time to explain the project in your latest email, you have
given me enough to see at least four ways to accomplish synchronization, all
of which I have implemented in real-world projects.

If you would like to take advantage of my offer please contact me at
mi****@getdotnetcode.com. Ideally we could talk on the phone for 15-30
minutes and nail down enough specifics for me to prepare a written
recommendation and some example code.

If you do not want to go in this direction I will answer your latest post
directly here in the newsgroup.

Regards,
--
Mike

Mike McIntyre
Visual Basic MVP
www.getdotnetcode.com

"Bob Achgill" <an*******@discussions.microsoft.com> wrote in message
news:17*****************************@phx.gbl...
Hi Mike,

Thank you for your advice.

We are making a free program that will run on Pentium 1
class computer with 16MB video card.

It will help illiterate people to learn to read their
native language.

The reading program is in VB .Net

As the student reads text in a WebBrowser window with in
the VB program it looks in the local database for each
word meaning and shows the associated Flash animation for
that word meaning to help the student understand the
meaning of the word. We also show an associated 3D
animation of the hand sign for that word meaning. We
pass this info from the VB .Net program to our C++
program that shows the hand sign.

Our users (in a 3rd world country) will probably
initially have someone hand them a CD that has the
starting programs+mdb+animation files for the language
they are working on learning to read. Let's say one
language will be about
1,800 - Flash animations ( 5 - 30 K each)
1,800 - 3D vector sign files (1-3K each)
mdb - with lexicon and pointers to Flash and sign
files (1MB)

As you can imagine such a system will have a lot of
updates as volunteers add or revise new animations and
hand signs. So we will give the capability to "phone
home" and receive updates if the user has internet
access.

We can use either use pulling rows from a server as an
option to do this and or FTP. The files could either be
packed in the rows and unpacked or straight FTP to the
client disk. If they are straight FTP then hence I need
to have Create Time stamps to determine version of the
files to be replaced on the client machine. If we go the
row transfer method for moving the files then I don't
need to rely on file time stamps.

Any advice on how to make this simpler is much
appreciated!

Bob
-----Original Message-----
Bob,

Time formats do matter. If you have a different date

formats you will need
to create code that can convert between any of the time

formats used in your
update process. This conversion code will be used

anywhere you need to
create, stamp, read, and compare dates coming from and

going to different
formats.

Regional time differences must be considered. One

approach to dealing with
time stamps accross time regions is to use coordinated

universal time (UTC).
UTC can be used convert time on the server and time from

a remote client to
UTC so you can make an apples to apples comparrison.

To update the user - are you pushing table rows to a

table in a remote
user's copy of the Access database you have on the

server? Or are you
pushing a new database (mdb) to them? If neither of

these questions is true
what type of file are you keeping up on the remote

client?

I ask because there are other approaches to keeping the

remote client in
sync that do not involve working with a file's DateTime.

I may be able to
provide directions for a simpler and more stable

approach.


--
Mike

Mike McIntyre
Visual Basic MVP
www.getdotnetcode.com

"Bob Achgill" <an*******@discussions.microsoft.com>

wrote in message
news:17*****************************@phx.gbl...
My question is about the order of the time/date pieces...
On one users computer he may have set his month to be
first and the day second

But in my Access data base I have the reversed...

so when I try to use the file info to check the Create
time or set the Create time I am apples and oranges
different between how the data base is talking time and
date and the Access data base is talking time and date.

Does it matter that the user has a different regional
setting for the order of time and date? Is that just
formatting as it appears to the eye of the user AND
beneath the covers the time and date appear the same
between the Access data base and the Windows operating
system??

>-----Original Message-----
>> How do I reconcile the fact that the user's computer
>> regional setting for date might be set to
>> 31/2/1959 11:59:59 PM
>>
>> But Access has the date stored as
>> 2/31/1959 11:59:59 PM
>>
>> Are they really the same standard format beneath the
>> covers??
>
>Hi Bob,
>
>No that would not be the case.
>
>What I do when working with SQL is get the time of the
SQL Server it is
>pulling info from in order to be indpependant of the
users clock. In your
>case I would find some outside source that you could
access that will give
>you a time (another server on the internet etc) to
compare.
>
>
>.
>

.

Nov 20 '05 #9

P: n/a
Thank you.

I will write you.

Bob
-----Original Message-----
Bob,

If you wish I am willing to donate some free time to help you work up thebest synchronization approach for this project.

By taking the time to explain the project in your latest email, you havegiven me enough to see at least four ways to accomplish synchronization, allof which I have implemented in real-world projects.

If you would like to take advantage of my offer please contact me atmi****@getdotnetcode.com. Ideally we could talk on the phone for 15-30minutes and nail down enough specifics for me to prepare a writtenrecommendation and some example code.

If you do not want to go in this direction I will answer your latest postdirectly here in the newsgroup.

Regards,
--
Mike

Mike McIntyre
Visual Basic MVP
www.getdotnetcode.com

Nov 20 '05 #10

This discussion thread is closed

Replies have been disabled for this discussion.