DateDiff in C#

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Mark Fox

    #1

    DateDiff in C#

    Hello,

    I am attempting to port some VB.NET code to C#.NET
    and have run across the DateDiff function in VB.NET.
    Does anyone know what the analogous function in C#.NET
    is? Thanks!
  • Elliot Rodriguez

    #2
    Re: DateDiff in C#

    Mark:

    You can use the TimeSpan object to help get the differences between 2 dates.

    Check out this example:
    http://msdn.microsoft.com/library/de...tesvisualc.asp

    --
    Elliot M. Rodriguez, MCSD
    *** It would take 227 cans of Mountain Dew to kill me***



    "Mark Fox" <info@solelsoft ware.com> wrote in message
    news:0a9f01c34b 92$84d20290$a30 1280a@phx.gbl.. .[color=blue]
    > Hello,
    >
    > I am attempting to port some VB.NET code to C#.NET
    > and have run across the DateDiff function in VB.NET.
    > Does anyone know what the analogous function in C#.NET
    > is? Thanks![/color]


    Comment

    • Anatoly

      #3
      Re: DateDiff in C#

      Look at
      DateTime.Substr act method

      "Mark Fox" <info@solelsoft ware.com> wrote in message
      news:0a9f01c34b 92$84d20290$a30 1280a@phx.gbl.. .[color=blue]
      > Hello,
      >
      > I am attempting to port some VB.NET code to C#.NET
      > and have run across the DateDiff function in VB.NET.
      > Does anyone know what the analogous function in C#.NET
      > is? Thanks![/color]


      Comment

      • Kevin Spencer

        #4
        Re: DateDiff in C#

        Check out the DateTime.Subtra ct() method.

        --
        HTH,

        Kevin Spencer
        Microsoft MVP
        ..Net Developer
        All hotels in Benidorm. The best selection of Benidorm hotels with reviews and maps. Book in advance and save.

        Big things are made up of
        lots of little things.

        "Mark Fox" <info@solelsoft ware.com> wrote in message
        news:0a9f01c34b 92$84d20290$a30 1280a@phx.gbl.. .[color=blue]
        > Hello,
        >
        > I am attempting to port some VB.NET code to C#.NET
        > and have run across the DateDiff function in VB.NET.
        > Does anyone know what the analogous function in C#.NET
        > is? Thanks![/color]


        Comment

        Working...