Hi

I need to convert date values in double. I have noticed that the CF 1
doesn't support the ToOADate method.
any idea to do this by code (vs2003 + vb.net + CF1.1)

regards

Re: ToOADate method by Sergey

Sergey
Fri Mar 03 02:24:52 CST 2006

You can use .Ticks to get long instead of double. If you really want to
get double here you are an example:

DateTime t = DateTime.Now;
double r = TicksToOADate(t.Ticks)

...

private static double TicksToOADate(long value)
{
if (value == 0) return 0;
if (value < 0xc92a69c000)
{
value += 0x85103c0cb83c000;
}

if (value < 0x6efdddaec64000) throw new OverflowException();

long l = (value - 0x85103c0cb83c000) / ((long) 0x2710);
if (l < 0)
{
long t = l % ((long) 0x5265c00);
if (t != 0) l -= (0x5265c00 + t) * 2;
}
return ((double)l) / 86400000;
}


FYI, CF2.0 already supports ToOADate().

--
Sergey Bogdanov [.NET CF MVP, MCSD]
http://www.sergeybogdanov.com


RobertM wrote:
> Hi
>
> I need to convert date values in double. I have noticed that the CF 1
> doesn't support the ToOADate method.
> any idea to do this by code (vs2003 + vb.net + CF1.1)
>
> regards
>
>

Re: ToOADate method by RobertM

RobertM
Fri Mar 03 03:10:08 CST 2006

Hi Sergey

thanks a lot but i don't understand C# code
any clue with vb code ?

regards

"Sergey Bogdanov" <sergey.bogdanov@gmail.com> a ecrit dans le message de
news: u7TwwvpPGHA.564@TK2MSFTNGP12.phx.gbl...
> You can use .Ticks to get long instead of double. If you really want to
> get double here you are an example:
>
> DateTime t = DateTime.Now;
> double r = TicksToOADate(t.Ticks)
>
> ...
>
> private static double TicksToOADate(long value)
> {
> if (value == 0) return 0;
> if (value < 0xc92a69c000)
> {
> value += 0x85103c0cb83c000;
> }
>
> if (value < 0x6efdddaec64000) throw new OverflowException();
>
> long l = (value - 0x85103c0cb83c000) / ((long) 0x2710);
> if (l < 0)
> {
> long t = l % ((long) 0x5265c00);
> if (t != 0) l -= (0x5265c00 + t) * 2;
> }
> return ((double)l) / 86400000;
> }
>
>
> FYI, CF2.0 already supports ToOADate().
>
> --
> Sergey Bogdanov [.NET CF MVP, MCSD]
> http://www.sergeybogdanov.com
>
>
> RobertM wrote:
>> Hi
>>
>> I need to convert date values in double. I have noticed that the CF 1
>> doesn't support the ToOADate method.
>> any idea to do this by code (vs2003 + vb.net + CF1.1)
>>
>> regards



Re: ToOADate method by ctacke/>

ctacke/>
Fri Mar 03 05:21:44 CST 2006

http://www.danielmoth.com/Blog/2005/03/please-read-before-posting-to-ng.html

See point #11

-Chris


"RobertM" <f> wrote in message news:Ojt1GJqPGHA.5464@TK2MSFTNGP11.phx.gbl...
> Hi Sergey
>
> thanks a lot but i don't understand C# code
> any clue with vb code ?
>
> regards
>
> "Sergey Bogdanov" <sergey.bogdanov@gmail.com> a ecrit dans le message de
> news: u7TwwvpPGHA.564@TK2MSFTNGP12.phx.gbl...
>> You can use .Ticks to get long instead of double. If you really want to
>> get double here you are an example:
>>
>> DateTime t = DateTime.Now;
>> double r = TicksToOADate(t.Ticks)
>>
>> ...
>>
>> private static double TicksToOADate(long value)
>> {
>> if (value == 0) return 0;
>> if (value < 0xc92a69c000)
>> {
>> value += 0x85103c0cb83c000;
>> }
>>
>> if (value < 0x6efdddaec64000) throw new OverflowException();
>>
>> long l = (value - 0x85103c0cb83c000) / ((long) 0x2710);
>> if (l < 0)
>> {
>> long t = l % ((long) 0x5265c00);
>> if (t != 0) l -= (0x5265c00 + t) * 2;
>> }
>> return ((double)l) / 86400000;
>> }
>>
>>
>> FYI, CF2.0 already supports ToOADate().
>>
>> --
>> Sergey Bogdanov [.NET CF MVP, MCSD]
>> http://www.sergeybogdanov.com
>>
>>
>> RobertM wrote:
>>> Hi
>>>
>>> I need to convert date values in double. I have noticed that the CF 1
>>> doesn't support the ToOADate method.
>>> any idea to do this by code (vs2003 + vb.net + CF1.1)
>>>
>>> regards
>
>



Re: ToOADate method by Sergey

Sergey
Fri Mar 03 06:48:37 CST 2006

... and one of C#=>VB.NET translators can be found here:
http://csharpconverter.claritycon.com/Default.aspx


--
Sergey Bogdanov [.NET CF MVP, MCSD]
http://www.sergeybogdanov.com


RobertM wrote:
> Hi Sergey
>
> thanks a lot but i don't understand C# code
> any clue with vb code ?
>
> regards
>
> "Sergey Bogdanov" <sergey.bogdanov@gmail.com> a ecrit dans le message de
> news: u7TwwvpPGHA.564@TK2MSFTNGP12.phx.gbl...
>> You can use .Ticks to get long instead of double. If you really want to
>> get double here you are an example:
>>
>> DateTime t = DateTime.Now;
>> double r = TicksToOADate(t.Ticks)
>>
>> ...
>>
>> private static double TicksToOADate(long value)
>> {
>> if (value == 0) return 0;
>> if (value < 0xc92a69c000)
>> {
>> value += 0x85103c0cb83c000;
>> }
>>
>> if (value < 0x6efdddaec64000) throw new OverflowException();
>>
>> long l = (value - 0x85103c0cb83c000) / ((long) 0x2710);
>> if (l < 0)
>> {
>> long t = l % ((long) 0x5265c00);
>> if (t != 0) l -= (0x5265c00 + t) * 2;
>> }
>> return ((double)l) / 86400000;
>> }
>>
>>
>> FYI, CF2.0 already supports ToOADate().
>>
>> --
>> Sergey Bogdanov [.NET CF MVP, MCSD]
>> http://www.sergeybogdanov.com
>>
>>
>> RobertM wrote:
>>> Hi
>>>
>>> I need to convert date values in double. I have noticed that the CF 1
>>> doesn't support the ToOADate method.
>>> any idea to do this by code (vs2003 + vb.net + CF1.1)
>>>
>>> regards
>
>

Re: ToOADate method by RobertM

RobertM
Fri Mar 03 07:47:40 CST 2006

thanks a lot

"Sergey Bogdanov" <sergey.bogdanov@gmail.com> a ecrit dans le message de
news: unIFJDsPGHA.2012@TK2MSFTNGP14.phx.gbl...
> ... and one of C#=>VB.NET translators can be found here:
> http://csharpconverter.claritycon.com/Default.aspx
>
>
> --
> Sergey Bogdanov [.NET CF MVP, MCSD]
> http://www.sergeybogdanov.com
>
>
> RobertM wrote:
>> Hi Sergey
>>
>> thanks a lot but i don't understand C# code
>> any clue with vb code ?
>>
>> regards
>>
>> "Sergey Bogdanov" <sergey.bogdanov@gmail.com> a ecrit dans le message de
>> news: u7TwwvpPGHA.564@TK2MSFTNGP12.phx.gbl...
>>> You can use .Ticks to get long instead of double. If you really want to
>>> get double here you are an example:
>>>
>>> DateTime t = DateTime.Now;
>>> double r = TicksToOADate(t.Ticks)
>>>
>>> ...
>>>
>>> private static double TicksToOADate(long value)
>>> {
>>> if (value == 0) return 0;
>>> if (value < 0xc92a69c000)
>>> {
>>> value += 0x85103c0cb83c000;
>>> }
>>>
>>> if (value < 0x6efdddaec64000) throw new OverflowException();
>>>
>>> long l = (value - 0x85103c0cb83c000) / ((long) 0x2710);
>>> if (l < 0)
>>> {
>>> long t = l % ((long) 0x5265c00);
>>> if (t != 0) l -= (0x5265c00 + t) * 2;
>>> }
>>> return ((double)l) / 86400000;
>>> }
>>>
>>>
>>> FYI, CF2.0 already supports ToOADate().
>>>
>>> --
>>> Sergey Bogdanov [.NET CF MVP, MCSD]
>>> http://www.sergeybogdanov.com
>>>
>>>
>>> RobertM wrote:
>>>> Hi
>>>>
>>>> I need to convert date values in double. I have noticed that the CF 1
>>>> doesn't support the ToOADate method.
>>>> any idea to do this by code (vs2003 + vb.net + CF1.1)
>>>>
>>>> regards
>>


Re: ToOADate method by RobertM

RobertM
Fri Mar 03 07:48:33 CST 2006

what's wrong with you ?

"<ctacke/>" <ctacke_AT_OpenNETCF_com> a écrit dans le message de news:
e7L4nSrPGHA.5352@TK2MSFTNGP10.phx.gbl...
> http://www.danielmoth.com/Blog/2005/03/please-read-before-posting-to-ng.html
>
> See point #11
>
> -Chris
>
>
> "RobertM" <f> wrote in message
> news:Ojt1GJqPGHA.5464@TK2MSFTNGP11.phx.gbl...
>> Hi Sergey
>>
>> thanks a lot but i don't understand C# code
>> any clue with vb code ?
>>
>> regards
>>
>> "Sergey Bogdanov" <sergey.bogdanov@gmail.com> a ecrit dans le message de
>> news: u7TwwvpPGHA.564@TK2MSFTNGP12.phx.gbl...
>>> You can use .Ticks to get long instead of double. If you really want to
>>> get double here you are an example:
>>>
>>> DateTime t = DateTime.Now;
>>> double r = TicksToOADate(t.Ticks)
>>>
>>> ...
>>>
>>> private static double TicksToOADate(long value)
>>> {
>>> if (value == 0) return 0;
>>> if (value < 0xc92a69c000)
>>> {
>>> value += 0x85103c0cb83c000;
>>> }
>>>
>>> if (value < 0x6efdddaec64000) throw new OverflowException();
>>>
>>> long l = (value - 0x85103c0cb83c000) / ((long) 0x2710);
>>> if (l < 0)
>>> {
>>> long t = l % ((long) 0x5265c00);
>>> if (t != 0) l -= (0x5265c00 + t) * 2;
>>> }
>>> return ((double)l) / 86400000;
>>> }
>>>
>>>
>>> FYI, CF2.0 already supports ToOADate().
>>>
>>> --
>>> Sergey Bogdanov [.NET CF MVP, MCSD]
>>> http://www.sergeybogdanov.com
>>>
>>>
>>> RobertM wrote:
>>>> Hi
>>>>
>>>> I need to convert date values in double. I have noticed that the CF 1
>>>> doesn't support the ToOADate method.
>>>> any idea to do this by code (vs2003 + vb.net + CF1.1)
>>>>
>>>> regards
>>
>>
>
>



Re: ToOADate method by Chris

Chris
Fri Mar 03 08:19:55 CST 2006


I'm pointing out that the solution was given. Asking for someone to rewrite
what is essentially math, and not at all complex is a bit much. He gave you
the solution, the least you could do is make the effort to convert it to VB,
then if you have trouble with some part of the conversion come back and ask
about it.

The shocker of doing that is that you might actually learn how it works,
rather than exercising your cut and paste skills.

-Chris


"RobertM" <f> wrote in message
news:%23I4roksPGHA.2704@TK2MSFTNGP15.phx.gbl...
> what's wrong with you ?
>
> "<ctacke/>" <ctacke_AT_OpenNETCF_com> a écrit dans le message de news:
> e7L4nSrPGHA.5352@TK2MSFTNGP10.phx.gbl...
>> http://www.danielmoth.com/Blog/2005/03/please-read-before-posting-to-ng.html
>>
>> See point #11
>>
>> -Chris
>>
>>
>> "RobertM" <f> wrote in message
>> news:Ojt1GJqPGHA.5464@TK2MSFTNGP11.phx.gbl...
>>> Hi Sergey
>>>
>>> thanks a lot but i don't understand C# code
>>> any clue with vb code ?
>>>
>>> regards
>>>
>>> "Sergey Bogdanov" <sergey.bogdanov@gmail.com> a ecrit dans le message de
>>> news: u7TwwvpPGHA.564@TK2MSFTNGP12.phx.gbl...
>>>> You can use .Ticks to get long instead of double. If you really want to
>>>> get double here you are an example:
>>>>
>>>> DateTime t = DateTime.Now;
>>>> double r = TicksToOADate(t.Ticks)
>>>>
>>>> ...
>>>>
>>>> private static double TicksToOADate(long value)
>>>> {
>>>> if (value == 0) return 0;
>>>> if (value < 0xc92a69c000)
>>>> {
>>>> value += 0x85103c0cb83c000;
>>>> }
>>>>
>>>> if (value < 0x6efdddaec64000) throw new OverflowException();
>>>>
>>>> long l = (value - 0x85103c0cb83c000) / ((long) 0x2710);
>>>> if (l < 0)
>>>> {
>>>> long t = l % ((long) 0x5265c00);
>>>> if (t != 0) l -= (0x5265c00 + t) * 2;
>>>> }
>>>> return ((double)l) / 86400000;
>>>> }
>>>>
>>>>
>>>> FYI, CF2.0 already supports ToOADate().
>>>>
>>>> --
>>>> Sergey Bogdanov [.NET CF MVP, MCSD]
>>>> http://www.sergeybogdanov.com
>>>>
>>>>
>>>> RobertM wrote:
>>>>> Hi
>>>>>
>>>>> I need to convert date values in double. I have noticed that the CF 1
>>>>> doesn't support the ToOADate method.
>>>>> any idea to do this by code (vs2003 + vb.net + CF1.1)
>>>>>
>>>>> regards
>>>
>>>
>>
>>
>
>



Re: ToOADate method by Chris

Chris
Fri Mar 03 08:40:07 CST 2006

This is also helpful for those wanting to do the VB->C# conversion

http://www.danielmoth.com/Blog/2005/03/using-c-from-vb-level-000.html

-Chris

"RobertM" <f> wrote in message
news:%23I4roksPGHA.2704@TK2MSFTNGP15.phx.gbl...
> what's wrong with you ?
>
> "<ctacke/>" <ctacke_AT_OpenNETCF_com> a écrit dans le message de news:
> e7L4nSrPGHA.5352@TK2MSFTNGP10.phx.gbl...
>> http://www.danielmoth.com/Blog/2005/03/please-read-before-posting-to-ng.html
>>
>> See point #11
>>
>> -Chris
>>
>>
>> "RobertM" <f> wrote in message
>> news:Ojt1GJqPGHA.5464@TK2MSFTNGP11.phx.gbl...
>>> Hi Sergey
>>>
>>> thanks a lot but i don't understand C# code
>>> any clue with vb code ?
>>>
>>> regards
>>>
>>> "Sergey Bogdanov" <sergey.bogdanov@gmail.com> a ecrit dans le message de
>>> news: u7TwwvpPGHA.564@TK2MSFTNGP12.phx.gbl...
>>>> You can use .Ticks to get long instead of double. If you really want to
>>>> get double here you are an example:
>>>>
>>>> DateTime t = DateTime.Now;
>>>> double r = TicksToOADate(t.Ticks)
>>>>
>>>> ...
>>>>
>>>> private static double TicksToOADate(long value)
>>>> {
>>>> if (value == 0) return 0;
>>>> if (value < 0xc92a69c000)
>>>> {
>>>> value += 0x85103c0cb83c000;
>>>> }
>>>>
>>>> if (value < 0x6efdddaec64000) throw new OverflowException();
>>>>
>>>> long l = (value - 0x85103c0cb83c000) / ((long) 0x2710);
>>>> if (l < 0)
>>>> {
>>>> long t = l % ((long) 0x5265c00);
>>>> if (t != 0) l -= (0x5265c00 + t) * 2;
>>>> }
>>>> return ((double)l) / 86400000;
>>>> }
>>>>
>>>>
>>>> FYI, CF2.0 already supports ToOADate().
>>>>
>>>> --
>>>> Sergey Bogdanov [.NET CF MVP, MCSD]
>>>> http://www.sergeybogdanov.com
>>>>
>>>>
>>>> RobertM wrote:
>>>>> Hi
>>>>>
>>>>> I need to convert date values in double. I have noticed that the CF 1
>>>>> doesn't support the ToOADate method.
>>>>> any idea to do this by code (vs2003 + vb.net + CF1.1)
>>>>>
>>>>> regards
>>>
>>>
>>
>>
>
>



Re: ToOADate method by RobertM

RobertM
Fri Mar 03 09:06:52 CST 2006

you use math !!!!!!!!!!!!!
i.e. something that someone else wrote
... you lazy guy


"Chris Tacke, MVP" <ctacke@spamfree-opennetcf.org> a écrit dans le message
de news: uzpEh2sPGHA.648@TK2MSFTNGP14.phx.gbl...
>
> I'm pointing out that the solution was given. Asking for someone to
> rewrite what is essentially math, and not at all complex is a bit much.
> He gave you the solution, the least you could do is make the effort to
> convert it to VB, then if you have trouble with some part of the
> conversion come back and ask about it.
>
> The shocker of doing that is that you might actually learn how it works,
> rather than exercising your cut and paste skills.
>
> -Chris
>
>
> "RobertM" <f> wrote in message
> news:%23I4roksPGHA.2704@TK2MSFTNGP15.phx.gbl...
>> what's wrong with you ?
>>
>> "<ctacke/>" <ctacke_AT_OpenNETCF_com> a écrit dans le message de news:
>> e7L4nSrPGHA.5352@TK2MSFTNGP10.phx.gbl...
>>> http://www.danielmoth.com/Blog/2005/03/please-read-before-posting-to-ng.html
>>>
>>> See point #11
>>>
>>> -Chris
>>>
>>>
>>> "RobertM" <f> wrote in message
>>> news:Ojt1GJqPGHA.5464@TK2MSFTNGP11.phx.gbl...
>>>> Hi Sergey
>>>>
>>>> thanks a lot but i don't understand C# code
>>>> any clue with vb code ?
>>>>
>>>> regards
>>>>
>>>> "Sergey Bogdanov" <sergey.bogdanov@gmail.com> a ecrit dans le message
>>>> de news: u7TwwvpPGHA.564@TK2MSFTNGP12.phx.gbl...
>>>>> You can use .Ticks to get long instead of double. If you really want
>>>>> to get double here you are an example:
>>>>>
>>>>> DateTime t = DateTime.Now;
>>>>> double r = TicksToOADate(t.Ticks)
>>>>>
>>>>> ...
>>>>>
>>>>> private static double TicksToOADate(long value)
>>>>> {
>>>>> if (value == 0) return 0;
>>>>> if (value < 0xc92a69c000)
>>>>> {
>>>>> value += 0x85103c0cb83c000;
>>>>> }
>>>>>
>>>>> if (value < 0x6efdddaec64000) throw new OverflowException();
>>>>>
>>>>> long l = (value - 0x85103c0cb83c000) / ((long) 0x2710);
>>>>> if (l < 0)
>>>>> {
>>>>> long t = l % ((long) 0x5265c00);
>>>>> if (t != 0) l -= (0x5265c00 + t) * 2;
>>>>> }
>>>>> return ((double)l) / 86400000;
>>>>> }
>>>>>
>>>>>
>>>>> FYI, CF2.0 already supports ToOADate().
>>>>>
>>>>> --
>>>>> Sergey Bogdanov [.NET CF MVP, MCSD]
>>>>> http://www.sergeybogdanov.com
>>>>>
>>>>>
>>>>> RobertM wrote:
>>>>>> Hi
>>>>>>
>>>>>> I need to convert date values in double. I have noticed that the CF 1
>>>>>> doesn't support the ToOADate method.
>>>>>> any idea to do this by code (vs2003 + vb.net + CF1.1)
>>>>>>
>>>>>> regards
>>>>
>>>>
>>>
>>>
>>
>>
>
>



Re: ToOADate method by Paul

Paul
Fri Mar 03 09:28:09 CST 2006

OK, so you're trying to make sure that you never get any help in the future?
You, not Chris, are the new one here. If you want to walk into a room and
immediately try to make sure that everyone hates you, you are obviously on
the right track...

Paul T.

"RobertM" <f> wrote in message
news:%23l3vcQtPGHA.516@TK2MSFTNGP15.phx.gbl...
> you use math !!!!!!!!!!!!!
> i.e. something that someone else wrote
> ... you lazy guy
>
>
> "Chris Tacke, MVP" <ctacke@spamfree-opennetcf.org> a écrit dans le message
> de news: uzpEh2sPGHA.648@TK2MSFTNGP14.phx.gbl...
>>
>> I'm pointing out that the solution was given. Asking for someone to
>> rewrite what is essentially math, and not at all complex is a bit much.
>> He gave you the solution, the least you could do is make the effort to
>> convert it to VB, then if you have trouble with some part of the
>> conversion come back and ask about it.
>>
>> The shocker of doing that is that you might actually learn how it works,
>> rather than exercising your cut and paste skills.
>>
>> -Chris
>>
>>
>> "RobertM" <f> wrote in message
>> news:%23I4roksPGHA.2704@TK2MSFTNGP15.phx.gbl...
>>> what's wrong with you ?
>>>
>>> "<ctacke/>" <ctacke_AT_OpenNETCF_com> a écrit dans le message de news:
>>> e7L4nSrPGHA.5352@TK2MSFTNGP10.phx.gbl...
>>>> http://www.danielmoth.com/Blog/2005/03/please-read-before-posting-to-ng.html
>>>>
>>>> See point #11
>>>>
>>>> -Chris
>>>>
>>>>
>>>> "RobertM" <f> wrote in message
>>>> news:Ojt1GJqPGHA.5464@TK2MSFTNGP11.phx.gbl...
>>>>> Hi Sergey
>>>>>
>>>>> thanks a lot but i don't understand C# code
>>>>> any clue with vb code ?
>>>>>
>>>>> regards
>>>>>
>>>>> "Sergey Bogdanov" <sergey.bogdanov@gmail.com> a ecrit dans le message
>>>>> de news: u7TwwvpPGHA.564@TK2MSFTNGP12.phx.gbl...
>>>>>> You can use .Ticks to get long instead of double. If you really want
>>>>>> to get double here you are an example:
>>>>>>
>>>>>> DateTime t = DateTime.Now;
>>>>>> double r = TicksToOADate(t.Ticks)
>>>>>>
>>>>>> ...
>>>>>>
>>>>>> private static double TicksToOADate(long value)
>>>>>> {
>>>>>> if (value == 0) return 0;
>>>>>> if (value < 0xc92a69c000)
>>>>>> {
>>>>>> value += 0x85103c0cb83c000;
>>>>>> }
>>>>>>
>>>>>> if (value < 0x6efdddaec64000) throw new OverflowException();
>>>>>>
>>>>>> long l = (value - 0x85103c0cb83c000) / ((long) 0x2710);
>>>>>> if (l < 0)
>>>>>> {
>>>>>> long t = l % ((long) 0x5265c00);
>>>>>> if (t != 0) l -= (0x5265c00 + t) * 2;
>>>>>> }
>>>>>> return ((double)l) / 86400000;
>>>>>> }
>>>>>>
>>>>>>
>>>>>> FYI, CF2.0 already supports ToOADate().
>>>>>>
>>>>>> --
>>>>>> Sergey Bogdanov [.NET CF MVP, MCSD]
>>>>>> http://www.sergeybogdanov.com
>>>>>>
>>>>>>
>>>>>> RobertM wrote:
>>>>>>> Hi
>>>>>>>
>>>>>>> I need to convert date values in double. I have noticed that the CF
>>>>>>> 1 doesn't support the ToOADate method.
>>>>>>> any idea to do this by code (vs2003 + vb.net + CF1.1)
>>>>>>>
>>>>>>> regards
>>>>>
>>>>>
>>>>
>>>>
>>>
>>>
>>
>>
>
>



Re: ToOADate method by RobertM

RobertM
Fri Mar 03 09:44:19 CST 2006

precisely!!!! i 'm a newbie
when I made a research in this forum with 'ToOADate' I didn't find any
answer
then which is the interest to say to me that I should seek better than ask
or do some math
if I come in a forum is precisely to find some assistance and not to be
said that I do not do it
it is ridiculous and counters the concept even of this forum

"Paul G. Tobey [eMVP]" <ptobey no spam AT no instrument no spam DOT com> a
écrit dans le message de news: ur7CSctPGHA.312@TK2MSFTNGP12.phx.gbl...
> OK, so you're trying to make sure that you never get any help in the
> future? You, not Chris, are the new one here. If you want to walk into a
> room and immediately try to make sure that everyone hates you, you are
> obviously on the right track...
>
> Paul T.
>
> "RobertM" <f> wrote in message
> news:%23l3vcQtPGHA.516@TK2MSFTNGP15.phx.gbl...
>> you use math !!!!!!!!!!!!!
>> i.e. something that someone else wrote
>> ... you lazy guy
>>
>>
>> "Chris Tacke, MVP" <ctacke@spamfree-opennetcf.org> a écrit dans le
>> message de news: uzpEh2sPGHA.648@TK2MSFTNGP14.phx.gbl...
>>>
>>> I'm pointing out that the solution was given. Asking for someone to
>>> rewrite what is essentially math, and not at all complex is a bit much.
>>> He gave you the solution, the least you could do is make the effort to
>>> convert it to VB, then if you have trouble with some part of the
>>> conversion come back and ask about it.
>>>
>>> The shocker of doing that is that you might actually learn how it works,
>>> rather than exercising your cut and paste skills.
>>>
>>> -Chris
>>>
>>>
>>> "RobertM" <f> wrote in message
>>> news:%23I4roksPGHA.2704@TK2MSFTNGP15.phx.gbl...
>>>> what's wrong with you ?
>>>>
>>>> "<ctacke/>" <ctacke_AT_OpenNETCF_com> a écrit dans le message de news:
>>>> e7L4nSrPGHA.5352@TK2MSFTNGP10.phx.gbl...
>>>>> http://www.danielmoth.com/Blog/2005/03/please-read-before-posting-to-ng.html
>>>>>
>>>>> See point #11
>>>>>
>>>>> -Chris
>>>>>
>>>>>
>>>>> "RobertM" <f> wrote in message
>>>>> news:Ojt1GJqPGHA.5464@TK2MSFTNGP11.phx.gbl...
>>>>>> Hi Sergey
>>>>>>
>>>>>> thanks a lot but i don't understand C# code
>>>>>> any clue with vb code ?
>>>>>>
>>>>>> regards
>>>>>>
>>>>>> "Sergey Bogdanov" <sergey.bogdanov@gmail.com> a ecrit dans le message
>>>>>> de news: u7TwwvpPGHA.564@TK2MSFTNGP12.phx.gbl...
>>>>>>> You can use .Ticks to get long instead of double. If you really want
>>>>>>> to get double here you are an example:
>>>>>>>
>>>>>>> DateTime t = DateTime.Now;
>>>>>>> double r = TicksToOADate(t.Ticks)
>>>>>>>
>>>>>>> ...
>>>>>>>
>>>>>>> private static double TicksToOADate(long value)
>>>>>>> {
>>>>>>> if (value == 0) return 0;
>>>>>>> if (value < 0xc92a69c000)
>>>>>>> {
>>>>>>> value += 0x85103c0cb83c000;
>>>>>>> }
>>>>>>>
>>>>>>> if (value < 0x6efdddaec64000) throw new OverflowException();
>>>>>>>
>>>>>>> long l = (value - 0x85103c0cb83c000) / ((long) 0x2710);
>>>>>>> if (l < 0)
>>>>>>> {
>>>>>>> long t = l % ((long) 0x5265c00);
>>>>>>> if (t != 0) l -= (0x5265c00 + t) * 2;
>>>>>>> }
>>>>>>> return ((double)l) / 86400000;
>>>>>>> }
>>>>>>>
>>>>>>>
>>>>>>> FYI, CF2.0 already supports ToOADate().
>>>>>>>
>>>>>>> --
>>>>>>> Sergey Bogdanov [.NET CF MVP, MCSD]
>>>>>>> http://www.sergeybogdanov.com
>>>>>>>
>>>>>>>
>>>>>>> RobertM wrote:
>>>>>>>> Hi
>>>>>>>>
>>>>>>>> I need to convert date values in double. I have noticed that the CF
>>>>>>>> 1 doesn't support the ToOADate method.
>>>>>>>> any idea to do this by code (vs2003 + vb.net + CF1.1)
>>>>>>>>
>>>>>>>> regards
>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>
>>>>
>>>
>>>
>>
>>
>
>



Re: ToOADate method by Paul

Paul
Fri Mar 03 09:56:46 CST 2006

The concept is to provide peer-to-peer support for software guys having
problems with .NET CF. Since .NET is a multi-language environment, we
expect you to take the initiative and, if we have code and post it for you
in C#, do the conversion yourself. It's not like Sergey's fix required you
to port several classes and two hundred lines of code, or even to look up
obscure syntax for, say, P/Invoking something written in native code.

You just come across as "I'm a poor VB.NET programmer. Please write my code
for me." I don't care what forum you post in, you're going to get a
reaction from that. If you read the threads around yours in the history of
the group, you'll find that you are the exception, not the rule, so it's
reasonable to assume that the one unique variable in your thread, you, are
the source of the difference.

Paul T.

"RobertM" <f> wrote in message news:eZFEVltPGHA.4956@TK2MSFTNGP09.phx.gbl...
> precisely!!!! i 'm a newbie
> when I made a research in this forum with 'ToOADate' I didn't find any
> answer
> then which is the interest to say to me that I should seek better than ask
> or do some math
> if I come in a forum is precisely to find some assistance and not to be
> said that I do not do it
> it is ridiculous and counters the concept even of this forum
>
> "Paul G. Tobey [eMVP]" <ptobey no spam AT no instrument no spam DOT com> a
> écrit dans le message de news: ur7CSctPGHA.312@TK2MSFTNGP12.phx.gbl...
>> OK, so you're trying to make sure that you never get any help in the
>> future? You, not Chris, are the new one here. If you want to walk into a
>> room and immediately try to make sure that everyone hates you, you are
>> obviously on the right track...
>>
>> Paul T.
>>
>> "RobertM" <f> wrote in message
>> news:%23l3vcQtPGHA.516@TK2MSFTNGP15.phx.gbl...
>>> you use math !!!!!!!!!!!!!
>>> i.e. something that someone else wrote
>>> ... you lazy guy
>>>
>>>
>>> "Chris Tacke, MVP" <ctacke@spamfree-opennetcf.org> a écrit dans le
>>> message de news: uzpEh2sPGHA.648@TK2MSFTNGP14.phx.gbl...
>>>>
>>>> I'm pointing out that the solution was given. Asking for someone to
>>>> rewrite what is essentially math, and not at all complex is a bit much.
>>>> He gave you the solution, the least you could do is make the effort to
>>>> convert it to VB, then if you have trouble with some part of the
>>>> conversion come back and ask about it.
>>>>
>>>> The shocker of doing that is that you might actually learn how it
>>>> works, rather than exercising your cut and paste skills.
>>>>
>>>> -Chris
>>>>
>>>>
>>>> "RobertM" <f> wrote in message
>>>> news:%23I4roksPGHA.2704@TK2MSFTNGP15.phx.gbl...
>>>>> what's wrong with you ?
>>>>>
>>>>> "<ctacke/>" <ctacke_AT_OpenNETCF_com> a écrit dans le message de news:
>>>>> e7L4nSrPGHA.5352@TK2MSFTNGP10.phx.gbl...
>>>>>> http://www.danielmoth.com/Blog/2005/03/please-read-before-posting-to-ng.html
>>>>>>
>>>>>> See point #11
>>>>>>
>>>>>> -Chris
>>>>>>
>>>>>>
>>>>>> "RobertM" <f> wrote in message
>>>>>> news:Ojt1GJqPGHA.5464@TK2MSFTNGP11.phx.gbl...
>>>>>>> Hi Sergey
>>>>>>>
>>>>>>> thanks a lot but i don't understand C# code
>>>>>>> any clue with vb code ?
>>>>>>>
>>>>>>> regards
>>>>>>>
>>>>>>> "Sergey Bogdanov" <sergey.bogdanov@gmail.com> a ecrit dans le
>>>>>>> message de news: u7TwwvpPGHA.564@TK2MSFTNGP12.phx.gbl...
>>>>>>>> You can use .Ticks to get long instead of double. If you really
>>>>>>>> want to get double here you are an example:
>>>>>>>>
>>>>>>>> DateTime t = DateTime.Now;
>>>>>>>> double r = TicksToOADate(t.Ticks)
>>>>>>>>
>>>>>>>> ...
>>>>>>>>
>>>>>>>> private static double TicksToOADate(long value)
>>>>>>>> {
>>>>>>>> if (value == 0) return 0;
>>>>>>>> if (value < 0xc92a69c000)
>>>>>>>> {
>>>>>>>> value += 0x85103c0cb83c000;
>>>>>>>> }
>>>>>>>>
>>>>>>>> if (value < 0x6efdddaec64000) throw new OverflowException();
>>>>>>>>
>>>>>>>> long l = (value - 0x85103c0cb83c000) / ((long) 0x2710);
>>>>>>>> if (l < 0)
>>>>>>>> {
>>>>>>>> long t = l % ((long) 0x5265c00);
>>>>>>>> if (t != 0) l -= (0x5265c00 + t) * 2;
>>>>>>>> }
>>>>>>>> return ((double)l) / 86400000;
>>>>>>>> }
>>>>>>>>
>>>>>>>>
>>>>>>>> FYI, CF2.0 already supports ToOADate().
>>>>>>>>
>>>>>>>> --
>>>>>>>> Sergey Bogdanov [.NET CF MVP, MCSD]
>>>>>>>> http://www.sergeybogdanov.com
>>>>>>>>
>>>>>>>>
>>>>>>>> RobertM wrote:
>>>>>>>>> Hi
>>>>>>>>>
>>>>>>>>> I need to convert date values in double. I have noticed that the
>>>>>>>>> CF 1 doesn't support the ToOADate method.
>>>>>>>>> any idea to do this by code (vs2003 + vb.net + CF1.1)
>>>>>>>>>
>>>>>>>>> regards
>>>>>>>
>>>>>>>
>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>
>>>>
>>>
>>>
>>
>>
>
>



Re: ToOADate method by Daniel

Daniel
Sat Mar 04 16:58:51 CST 2006

> when I made a research in this forum with 'ToOADate' I didn't find any
> answer
Where did you search? Searching this ng gives you this:
http://groups.google.com/group/microsoft.public.dotnet.framework.compactframework/browse_thread/thread/6bc1925a0a527a7d/c02e027f4d06f558?q=tooadate&rnum=3#c02e027f4d06f558
...which leads you to this (in VB no less):
http://www.opennetcf.org/Forums/topic.asp?TOPIC_ID=47

Cheers
Daniel
--
http://www.danielmoth.com/Blog/


"RobertM" <f> wrote in message news:eZFEVltPGHA.4956@TK2MSFTNGP09.phx.gbl...
> precisely!!!! i 'm a newbie
> when I made a research in this forum with 'ToOADate' I didn't find any
> answer
> then which is the interest to say to me that I should seek better than ask
> or do some math
> if I come in a forum is precisely to find some assistance and not to be
> said that I do not do it
> it is ridiculous and counters the concept even of this forum
>
> "Paul G. Tobey [eMVP]" <ptobey no spam AT no instrument no spam DOT com> a
> écrit dans le message de news: ur7CSctPGHA.312@TK2MSFTNGP12.phx.gbl...
>> OK, so you're trying to make sure that you never get any help in the
>> future? You, not Chris, are the new one here. If you want to walk into a
>> room and immediately try to make sure that everyone hates you, you are
>> obviously on the right track...
>>
>> Paul T.
>>
>> "RobertM" <f> wrote in message
>> news:%23l3vcQtPGHA.516@TK2MSFTNGP15.phx.gbl...
>>> you use math !!!!!!!!!!!!!
>>> i.e. something that someone else wrote
>>> ... you lazy guy
>>>
>>>
>>> "Chris Tacke, MVP" <ctacke@spamfree-opennetcf.org> a écrit dans le
>>> message de news: uzpEh2sPGHA.648@TK2MSFTNGP14.phx.gbl...
>>>>
>>>> I'm pointing out that the solution was given. Asking for someone to
>>>> rewrite what is essentially math, and not at all complex is a bit much.
>>>> He gave you the solution, the least you could do is make the effort to
>>>> convert it to VB, then if you have trouble with some part of the
>>>> conversion come back and ask about it.
>>>>
>>>> The shocker of doing that is that you might actually learn how it
>>>> works, rather than exercising your cut and paste skills.
>>>>
>>>> -Chris
>>>>
>>>>
>>>> "RobertM" <f> wrote in message
>>>> news:%23I4roksPGHA.2704@TK2MSFTNGP15.phx.gbl...
>>>>> what's wrong with you ?
>>>>>
>>>>> "<ctacke/>" <ctacke_AT_OpenNETCF_com> a écrit dans le message de news:
>>>>> e7L4nSrPGHA.5352@TK2MSFTNGP10.phx.gbl...
>>>>>> http://www.danielmoth.com/Blog/2005/03/please-read-before-posting-to-ng.html
>>>>>>
>>>>>> See point #11
>>>>>>
>>>>>> -Chris
>>>>>>
>>>>>>
>>>>>> "RobertM" <f> wrote in message
>>>>>> news:Ojt1GJqPGHA.5464@TK2MSFTNGP11.phx.gbl...
>>>>>>> Hi Sergey
>>>>>>>
>>>>>>> thanks a lot but i don't understand C# code
>>>>>>> any clue with vb code ?
>>>>>>>
>>>>>>> regards
>>>>>>>
>>>>>>> "Sergey Bogdanov" <sergey.bogdanov@gmail.com> a ecrit dans le
>>>>>>> message de news: u7TwwvpPGHA.564@TK2MSFTNGP12.phx.gbl...
>>>>>>>> You can use .Ticks to get long instead of double. If you really
>>>>>>>> want to get double here you are an example:
>>>>>>>>
>>>>>>>> DateTime t = DateTime.Now;
>>>>>>>> double r = TicksToOADate(t.Ticks)
>>>>>>>>
>>>>>>>> ...
>>>>>>>>
>>>>>>>> private static double TicksToOADate(long value)
>>>>>>>> {
>>>>>>>> if (value == 0) return 0;
>>>>>>>> if (value < 0xc92a69c000)
>>>>>>>> {
>>>>>>>> value += 0x85103c0cb83c000;
>>>>>>>> }
>>>>>>>>
>>>>>>>> if (value < 0x6efdddaec64000) throw new OverflowException();
>>>>>>>>
>>>>>>>> long l = (value - 0x85103c0cb83c000) / ((long) 0x2710);
>>>>>>>> if (l < 0)
>>>>>>>> {
>>>>>>>> long t = l % ((long) 0x5265c00);
>>>>>>>> if (t != 0) l -= (0x5265c00 + t) * 2;
>>>>>>>> }
>>>>>>>> return ((double)l) / 86400000;
>>>>>>>> }
>>>>>>>>
>>>>>>>>
>>>>>>>> FYI, CF2.0 already supports ToOADate().
>>>>>>>>
>>>>>>>> --
>>>>>>>> Sergey Bogdanov [.NET CF MVP, MCSD]
>>>>>>>> http://www.sergeybogdanov.com
>>>>>>>>
>>>>>>>>
>>>>>>>> RobertM wrote:
>>>>>>>>> Hi
>>>>>>>>>
>>>>>>>>> I need to convert date values in double. I have noticed that the
>>>>>>>>> CF 1 doesn't support the ToOADate method.
>>>>>>>>> any idea to do this by code (vs2003 + vb.net + CF1.1)
>>>>>>>>>
>>>>>>>>> regards
>>>>>>>
>>>>>>>
>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>
>>>>
>>>
>>>
>>
>>
>
>