converting Date to long

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Brian Shafer

    #1

    converting Date to long

    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?

  • Armin Zingler

    #2
    Re: converting Date to long

    "Brian Shafer" <BrianShafer@di scussions.micro soft.com> schrieb[color=blue]
    > 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?
    >[/color]

    Use the object's methods:

    Dim diff as timespan

    diff = userdate.subtra ct(mydate)


    Then access the Timespan's members.


    Armin

    Comment

    • Brian Shafer

      #3
      Re: converting Date to long

      Thanks, worked great


      "Armin Zingler" <az.nospam@free net.de> wrote in message
      news:uP7C5cyMGH A.668@TK2MSFTNG P11.phx.gbl...[color=blue]
      > "Brian Shafer" <BrianShafer@di scussions.micro soft.com> schrieb[color=green]
      >> 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?
      >>[/color]
      >
      > Use the object's methods:
      >
      > Dim diff as timespan
      >
      > diff = userdate.subtra ct(mydate)
      >
      >
      > Then access the Timespan's members.
      >
      >
      > Armin[/color]


      Comment

      Working...