Cor,
you've been very kind.
Can you please try this code? because I'm getting mad....
Dim dt As New DateTime(&H1C6366CABE6C280)
MessageBox.Show(dt.ToString)
ad3 = CDate("21/02/2006 00:33:29")
MessageBox.Show(dt.Ticks)
I get a meaningless 20/02/0406 22:26:19
(ok this is equal to my code, exactly the same wrong date)
while if I use all other programs (i.e. AXE 3)
I got: 2006/02/21 00:33:29
that is the right information.
the funny thing is that the Ticks of the right date are:
ad3.Ticks &H8C8049591E69280 Long
So it looks like that "old" ticks are different from new ones!
I realy don't understand
"Cor Ligthert [MVP]" wrote:
[color=blue]
> MSAvazzi,
>
> With all those discussions you would not understand it anymore therefore.
>
> This gives for me the creation date in UTC time which is at my place 2 hours
> before the current time.
>
> \\\
> Dim fi As New IO.FileInfo("c:\test.txt")
> Dim dt As New DateTime(fi.CreationTimeUtc.Ticks)
> MessageBox.Show(dt.ToString)
> ///
>
> I hope this helps,
>
> Cor
>
> "msavazzi" <m.savazzi@discussion.microsoft.com> schreef in bericht
> news:D2FC74A7-3AFD-4DAC-A8E2-8CCAB440DE8A@microsoft.com...[color=green]
> > Cor,
> > If I understood correctly it should be the function I'm using:
> > ad3 = DateTime.FromFileTimeUtc(aLn1)
> >
> >
> > Or I'm doing something wrong?
> >
> > M
> >
> > "Cor Ligthert [MVP]" wrote:
> >[color=darkred]
> >> And you tried this as well?
> >>
> >>
http://msdn.microsoft.com/library/de...meUtcTopic.asp
> >>
> >> Cor
> >>
> >> "msavazzi" <m.savazzi@discussion.microsoft.com> schreef in bericht
> >> news:BA22D001-B505-4EB9-A3A0-3BE38B4F5C8D@microsoft.com...
> >> > Cor,
> >> > I have a FILETIME (that I read from a File) and I want to store it in a
> >> > DateTime variable.
> >> >
> >> > And I do agree with you, it has a lot of methods.
> >> >
> >> > Unluckily it looks like THEY DON'T WORK (or is not clear how to have
> >> > them
> >> > work).
> >> > If you try the code I've posted you'll see.
> >> >
> >> > here is tha MSDN reference:
> >> >
http://msdn.microsoft.com/library/en...asp?frame=true
> >> >
> >> >
> >> >
> >> > M
> >> >
> >> > "Cor Ligthert [MVP]" wrote:
> >> >
> >> >> msAvazzi,
> >> >>
> >> >> What is it what you want to achieve, there are so many methods in
> >> >> datetime
> >> >> that I am not seeing what your goal is. I gues that is the same for
> >> >> others.
> >> >>
> >> >> By instance
> >> >>
http://msdn.microsoft.com/library/de...ssaddtopic.asp
> >> >>
> >> >> Cor
> >> >>
> >> >> "msavazzi" <m.savazzi@discussion.microsoft.com> schreef in bericht
> >> >> news:503FFC9E-0FF9-470B-BFA7-88A437EA8899@microsoft.com...
> >> >> > Hi,
> >> >> > it should be simple,
> >> >> > put FILETIME in a Long
> >> >> > conver it in date using the DateTime.FromFileTimeUtc
> >> >> >
> >> >> > The help even says: Converts the specified Windows file time to an
> >> >> > equivalent UTC time.
> >> >> >
> >> >> >
> >> >> > Now why happens this:
> >> >> > original filetime 21/02/2006 00:33:29
> >> >> >
> >> >> > bytes:
> >> >> > 80 C2 E6 AB
> >> >> > 6D 36 C6 01
> >> >> >
> >> >> > when I convert it I have:
> >> >> > 1) 20/02/2006 22:26:19
> >> >> > 2) 20/02/2006 22:26:19
> >> >> >
> >> >> > Code:
> >> >> > Dim ad3 As System.DateTime
> >> >> > Dim aLn1 As Long
> >> >> > Dim ad1 As System.Runtime.InteropServices.ComTypes.FILETIME
> >> >> >
> >> >> > ad1.dwHighDateTime = &H1C6366D
> >> >> > ad1.dwLowDateTime = &HABE6C280
> >> >> >
> >> >> > aLn1 = (CLng(ad1.dwHighDateTime) << 32) +
> >> >> > CLng(ad1.dwLowDateTime)
> >> >> >
> >> >> > ad3 = DateTime.FromFileTimeUtc(aLn1)
> >> >> > Debug.Print("1) " & ad3)
> >> >> > ad3.ToLocalTime()
> >> >> > Debug.Print("2) " & ad3)
> >> >> >
> >> >> > and even worst if I do:
> >> >> > ad3 = CDate("21/02/2006 00:33:29")
> >> >> >
> >> >> > the Thicks property is equal to:
> >> >> > ad3.Ticks &H8C8049591E69280 Long
> >> >> >
> >> >> >
> >> >> > please can anyone help me?
> >> >> >
> >> >> > Thanks,
> >> >> > M.
> >> >>
> >> >>
> >> >>
> >>
> >>
> >>[/color][/color]
>
>
>[/color]