Home All Groups Group Topic Archive Search About

FileSystemObject vs System.IO.File

Author
28 Mar 2005 12:17 PM
google_groups3
Hi all,

I am slowly re-writing old VB6 code to VB.NET.  I have 1 problem.  I
was using  FileSystemObject to return the modified timestamp of a
file, all worked well.

When I use System.IO.File.GetLastWriteTime(MyFile).ToShortTimeString
the time is 1 hour behind that of the file.  For example, I look in
Windows Explorer and see that the time stamp is 11:24.
System.IO.File.GetLastWriteTime(MyFile).ToShortTimeString reports it
at 10:24 though.

The system clock is set correctly and also if i test it with FSO, it
reports the same time as Windows Explorer.  What is wrong???

Thanks,
Steve

Author
28 Mar 2005 1:30 PM
Cor Ligthert
Author
28 Mar 2005 2:42 PM
Crouchie1998
I can see your point because I wrote a simple function & that displays the
time one hour earlier than explorer too. Take a look below:

Private Function GetFileLastWriteTime(ByVal sFile As String) As DateTime
Dim fiFile As New IO.FileInfo(sFile)
Dim dtFile As Date = fiFile.LastWriteTime
Return dtFile.ToShortTimeString
End Function
Author
28 Mar 2005 4:17 PM
google_groups3
Crouchie1998 wrote:
> I can see your point because I wrote a simple function & that
displays the
> time one hour earlier than explorer too. Take a look below:
>
> Private Function GetFileLastWriteTime(ByVal sFile As String) As
DateTime
> Dim fiFile As New IO.FileInfo(sFile)
> Dim dtFile As Date = fiFile.LastWriteTime
> Return dtFile.ToShortTimeString
> End Function

exactly.  I have not yet tried it with the FileInfo class as Cor
suggests, although I expect it to be the same because of the
specifications on MSDN.  1 question crouchie, what are your Regional
Settings?  i.e.  Which time zone are you set to?  I am set to +1 and of
course the clocks went forward this weekend!  I would be curious to
know if this happens to people with GMT or a different time zone to me.
I can only think that it is a bug as FSO reports it just fine.  Of
course, the problem with FSO is that it isn't .NET!

Any help appreciated.
Author
28 Mar 2005 6:16 PM
Cor Ligthert
Hi,

GMT is always the same, even in Greenwich where British Summer Time is used.

Cor
Author
29 Mar 2005 2:26 AM
Michael D. Ober
Clocks in the US spring forward next Sunday.  Are there countries where the
shift to Daylight Savings Time has occurred already?

Mike Ober.

<google_grou***@hotmail.com> wrote in message
Show quoteHide quote
news:1112026659.492020.109670@z14g2000cwz.googlegroups.com...
>
> Crouchie1998 wrote:
> > I can see your point because I wrote a simple function & that
> displays the
> > time one hour earlier than explorer too. Take a look below:
> >
> > Private Function GetFileLastWriteTime(ByVal sFile As String) As
> DateTime
> > Dim fiFile As New IO.FileInfo(sFile)
> > Dim dtFile As Date = fiFile.LastWriteTime
> > Return dtFile.ToShortTimeString
> > End Function
>
> exactly.  I have not yet tried it with the FileInfo class as Cor
> suggests, although I expect it to be the same because of the
> specifications on MSDN.  1 question crouchie, what are your Regional
> Settings?  i.e.  Which time zone are you set to?  I am set to +1 and of
> course the clocks went forward this weekend!  I would be curious to
> know if this happens to people with GMT or a different time zone to me.
>  I can only think that it is a bug as FSO reports it just fine.  Of
> course, the problem with FSO is that it isn't .NET!
>
> Any help appreciated.
>
Author
29 Mar 2005 7:03 AM
Cor Ligthert
Michael,

EU on Easter Saterday/Sunday

Cor
Author
1 Apr 2005 2:49 AM
Michael D. Ober
I suspect this problem will clear starting April 2nd.  If so, this appears
to be a bug in the regional settings of the .NET runtime and should be
reported to the Visual Studio team. - V 2.0 is in beta so now's the time to
get this fixed.

Mike Ober.

Show quoteHide quote
"Cor Ligthert" <notmyfirstn***@planet.nl> wrote in message
news:%23NVTF2CNFHA.3788@tk2msftngp13.phx.gbl...
> Michael,
>
> EU on Easter Saterday/Sunday
>
> Cor
>
>
Author
1 Apr 2005 7:21 AM
Daniel
I suspected that is was a bug.  So roll on tomorrow!

--

Daniel
MCSE, MCP+I, MCP in Windows 2000/NT

--------------------------------------
remove the 2nd madrid from my mail address to contact me.

Show quoteHide quote
"Michael D. Ober" <ober***@.alum.mit.edu.nospam> wrote in message
news:BE23e.1491$EE2.1004@newsread2.news.pas.earthlink.net...
>I suspect this problem will clear starting April 2nd.  If so, this appears
> to be a bug in the regional settings of the .NET runtime and should be
> reported to the Visual Studio team. - V 2.0 is in beta so now's the time
> to
> get this fixed.
>
> Mike Ober.
>
> "Cor Ligthert" <notmyfirstn***@planet.nl> wrote in message
> news:%23NVTF2CNFHA.3788@tk2msftngp13.phx.gbl...
>> Michael,
>>
>> EU on Easter Saterday/Sunday
>>
>> Cor
>>
>>
>
>
>
Author
29 Mar 2005 10:21 AM
Daniel
Clocks already changed here in Madrid and it causes the same problem for me!
Is it the same for people in the UK anyone?
--

Daniel
MCSE, MCP+I, MCP in Windows 2000/NT

--------------------------------------
remove the 2nd madrid from my mail address to contact me.

Show quoteHide quote
"Michael D. Ober" <ober***@.alum.mit.edu.nospam> wrote in message
news:l132e.6811$H06.6787@newsread3.news.pas.earthlink.net...
> Clocks in the US spring forward next Sunday.  Are there countries where
> the
> shift to Daylight Savings Time has occurred already?
>
> Mike Ober.
>
> <google_grou***@hotmail.com> wrote in message
> news:1112026659.492020.109670@z14g2000cwz.googlegroups.com...
>>
>> Crouchie1998 wrote:
>> > I can see your point because I wrote a simple function & that
>> displays the
>> > time one hour earlier than explorer too. Take a look below:
>> >
>> > Private Function GetFileLastWriteTime(ByVal sFile As String) As
>> DateTime
>> > Dim fiFile As New IO.FileInfo(sFile)
>> > Dim dtFile As Date = fiFile.LastWriteTime
>> > Return dtFile.ToShortTimeString
>> > End Function
>>
>> exactly.  I have not yet tried it with the FileInfo class as Cor
>> suggests, although I expect it to be the same because of the
>> specifications on MSDN.  1 question crouchie, what are your Regional
>> Settings?  i.e.  Which time zone are you set to?  I am set to +1 and of
>> course the clocks went forward this weekend!  I would be curious to
>> know if this happens to people with GMT or a different time zone to me.
>>  I can only think that it is a bug as FSO reports it just fine.  Of
>> course, the problem with FSO is that it isn't .NET!
>>
>> Any help appreciated.
>>
>
>
>
Author
29 Mar 2005 3:38 PM
Cor Ligthert
Daniel,

I was always thinking that Spain was a part of the EU, is that shortly ago
changed?

However to show you the summer times etc in the countries from the EU were
the UK is as well a part from.

http://wwp.greenwichmeantime.com/time-zone/rules/eu.htm

Cor
Author
31 Mar 2005 7:28 AM
Daniel
????  I never said it was not Cor.  I merely stated that I have the same
problem and I live in Spain AND the clocks here have already gone forward.

Sarcasm is the lowest form of wit.

--

Daniel
MCSE, MCP+I, MCP in Windows 2000/NT

--------------------------------------
remove the 2nd madrid from my mail address to contact me.

Show quoteHide quote
"Cor Ligthert" <notmyfirstn***@planet.nl> wrote in message
news:eCuD0VHNFHA.3704@TK2MSFTNGP12.phx.gbl...
> Daniel,
>
> I was always thinking that Spain was a part of the EU, is that shortly ago
> changed?
>
> However to show you the summer times etc in the countries from the EU were
> the UK is as well a part from.
>
> http://wwp.greenwichmeantime.com/time-zone/rules/eu.htm
>
> Cor
>
>
Author
31 Mar 2005 7:56 AM
Cor Ligthert
Daniel,

This is a developers newsgroup. I wrote 5 hours before you, that  the time
was changed in the EU.

Your message looked therefore for me as this kind of code

If  Country = EU then
    'time is changed
ElseIf
    State = Spain
    'time is changed
End if

And that kind of code I don't like, because it is only confusing pretending
if Spain is not a state of the EU and when it is absolute useless.

Therefore my message.

Cor
Author
31 Mar 2005 8:39 AM
Daniel
Cor.  When replying to Michael D. Ober I provided more information that just
a region of the world that the clocks have already changed.  So, instead of
just saying "EU on Easter Saterday/Sunday" I stated where I live, the fact
that the clocks have changed and importantly, the fact that I have the same
problem with this.

Far more helpful than your post.  So please, if you want to start a petty
argument or flame war, please do it with somebody else.  It is a shame when
people use these forums to irritate people.

If you wish to discuss this further, you can email me directly rather than
wasting people precious bandwidth by posting here.  Or maybe you can read it
better this way:

If DiscussSubjectFurther = True Then
    EmailMeDirect = True
Else
    Exit Thread
End IF

p.s.  5 hours is not that great a time difference when posting to groups.
Although I am using a newsreader to post, sometimes I use Google and that
can take many more hours than 5 for new messages to appear, often meaning
that 2 different people can reply to the same post without knowing about it.

--

Daniel
MCSE, MCP+I, MCP in Windows 2000/NT

--------------------------------------
remove the 2nd madrid from my mail address to contact me.

Show quoteHide quote
"Cor Ligthert" <notmyfirstn***@planet.nl> wrote in message
news:%23nQ7nccNFHA.2604@TK2MSFTNGP10.phx.gbl...
> Daniel,
>
> This is a developers newsgroup. I wrote 5 hours before you, that  the time
> was changed in the EU.
>
> Your message looked therefore for me as this kind of code
>
> If  Country = EU then
>    'time is changed
> ElseIf
>    State = Spain
>    'time is changed
> End if
>
> And that kind of code I don't like, because it is only confusing
> pretending if Spain is not a state of the EU and when it is absolute
> useless.
>
> Therefore my message.
>
> Cor
>
Author
31 Mar 2005 9:53 AM
Cor Ligthert
Daniel,

I did not noticed that it where flames from you to irritate me, glad that
you made me attend on it.

Therefore my last message.

Cor
Author
31 Mar 2005 10:00 AM
Daniel
Your post makes no sense.

--

Daniel
MCSE, MCP+I, MCP in Windows 2000/NT

--------------------------------------
remove the 2nd madrid from my mail address to contact me.

Show quoteHide quote
"Cor Ligthert" <notmyfirstn***@planet.nl> wrote in message
news:eumdbedNFHA.576@TK2MSFTNGP12.phx.gbl...
> Daniel,
>
> I did not noticed that it where flames from you to irritate me, glad that
> you made me attend on it.
>
> Therefore my last message.
>
> Cor
>