Results 1 to 4 of 4

Thread: [RESOLVED] sum days to a "datetime"

  1. #1

    Thread Starter
    Junior Member rzamith's Avatar
    Join Date
    May 2005
    Posts
    18

    Resolved [RESOLVED] sum days to a "datetime"

    Hi,

    How do I add days to a "datetime" type item?
    For example, I have:

    Dim m As DateTime = 12-05-2006

    How do I add 5 days to this item, so that its content becomes 17-05-2006 ?
    I tried to cast with an integer, but it's not possible.

  2. #2
    I'm about to be a PowerPoster! kleinma's Avatar
    Join Date
    Nov 2001
    Location
    NJ - USA (Near NYC)
    Posts
    23,373

    Re: sum days to a "datetime"

    VB Code:
    1. Dim m As New DateTime(2006, 12, 5)
    2.             MessageBox.Show(m.ToShortDateString)
    3.             m = m.AddDays(5)
    4.             MessageBox.Show(m.ToShortDateString)

  3. #3

    Thread Starter
    Junior Member rzamith's Avatar
    Join Date
    May 2005
    Posts
    18

    Re: sum days to a "datetime"

    excellent, thanks very much mate

  4. #4
    I'm about to be a PowerPoster! kleinma's Avatar
    Join Date
    Nov 2001
    Location
    NJ - USA (Near NYC)
    Posts
    23,373

    Re: sum days to a "datetime"

    No problem, mark the thread resolved using the thread tools if this particular question has been answered.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width