System.DateTime

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • A.M

    System.DateTime

    Hi,

    What would be the best way to know how many minute are between two DateTime
    values ?
    I tried DateTime1-DateTime2, but it doesn't work.

    Thanks,
    Ali



  • Brian W

    #2
    Re: System.DateTime

    Sure it does, with a little adjustment, try:

    Dim ts As TimeSpan = DateTime1 - DateTime2

    Dim minutes As Integer = ts.Minutes

    HTH
    Brian W


    "A.M" <IHateSpam@sapm 123.com> wrote in message
    news:ew%23F$3hq DHA.648@TK2MSFT NGP11.phx.gbl.. .[color=blue]
    > Hi,
    >
    > What would be the best way to know how many minute are between two[/color]
    DateTime[color=blue]
    > values ?
    > I tried DateTime1-DateTime2, but it doesn't work.
    >
    > Thanks,
    > Ali
    >
    >
    >[/color]


    Comment

    • Herfried K. Wagner [MVP]

      #3
      Re: System.DateTime

      * "A.M" <IHateSpam@sapm 123.com> scripsit:[color=blue]
      > What would be the best way to know how many minute are between two DateTime
      > values ?
      > I tried DateTime1-DateTime2, but it doesn't work.[/color]

      \\\
      Dim d1 As DateTime
      Dim d2 As DateTime
      MsgBox(d2.Subtr act(d1).TotalMi nutes.ToString( ))
      ///

      --
      Herfried K. Wagner
      MVP ยท VB Classic, VB.NET
      <http://www.mvps.org/dotnet>

      <http://www.plig.net/nnq/nquote.html>

      Comment

      Working...