Home All Groups Group Topic Archive Search About

converting Date to long

Author
16 Feb 2006 6:21 PM
Brian Shafer
In vb 6 i had a something like result = CLng(UserDate) - CLng(MyDate)
in vb.net I get an error
"Value of tyep 'Date' cannot be converted to 'Long'.

How do i get around this?

Author
16 Feb 2006 6:30 PM
Armin Zingler
"Brian Shafer" <BrianSha***@discussions.microsoft.com> schrieb
> In vb 6 i had a something like result = CLng(UserDate) -
> CLng(MyDate) in vb.net I get an error
> "Value of tyep 'Date' cannot be converted to 'Long'.
>
> How do i get around this?
>

Use the object's methods:

Dim diff as timespan

diff = userdate.subtract(mydate)


Then access the Timespan's members.


Armin
Author
18 Feb 2006 4:18 PM
Brian Shafer
Thanks, worked great


Show quoteHide quote
"Armin Zingler" <az.nospam@freenet.de> wrote in message
news:uP7C5cyMGHA.668@TK2MSFTNGP11.phx.gbl...
> "Brian Shafer" <BrianSha***@discussions.microsoft.com> schrieb
>> In vb 6 i had a something like result = CLng(UserDate) -
>> CLng(MyDate) in vb.net I get an error
>> "Value of tyep 'Date' cannot be converted to 'Long'.
>>
>> How do i get around this?
>>
>
> Use the object's methods:
>
> Dim diff as timespan
>
> diff = userdate.subtract(mydate)
>
>
> Then access the Timespan's members.
>
>
> Armin