Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. Dates in asp.net

Dates in asp.net

Scheduled Pinned Locked Moved ASP.NET
questioncsharpasp-nethelp
4 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • I Offline
    I Offline
    ishwarya mahadevan
    wrote on last edited by
    #1

    Hi I want a numeric value to be added to the current date. the numeric value is provided dynamically. how do i do it? i tried the following but showing error : textbox1.text=now.date+textbox2.text i also tried : textbox1.text=now.date+val(textbox2.text) it is treating the + as concat operator and not as addition.

    P A J 3 Replies Last reply
    0
    • I ishwarya mahadevan

      Hi I want a numeric value to be added to the current date. the numeric value is provided dynamically. how do i do it? i tried the following but showing error : textbox1.text=now.date+textbox2.text i also tried : textbox1.text=now.date+val(textbox2.text) it is treating the + as concat operator and not as addition.

      P Offline
      P Offline
      Parwej Ahamad
      wrote on last edited by
      #2

      AddDays method are provided there like:

      DateTime tomorrow = DateTime.Today.AddDays( 1 )

      Parwej Ahamad ahamad.parwej@gmail.com

      1 Reply Last reply
      0
      • I ishwarya mahadevan

        Hi I want a numeric value to be added to the current date. the numeric value is provided dynamically. how do i do it? i tried the following but showing error : textbox1.text=now.date+textbox2.text i also tried : textbox1.text=now.date+val(textbox2.text) it is treating the + as concat operator and not as addition.

        A Offline
        A Offline
        Abhishek Sur
        wrote on last edited by
        #3

        It depends on what you want to increase.

        Now.AddDays
        Now.AddSeconds
        Now.AddHours

        etc. Each of them asks for an integer value. so DateTime.Now.AddDays(Convert.ToInt32(textbox2.text)) I hope this would solve your issue.

        Abhishek Sur **Don't forget to click "Good Answer" if you like this Solution.


        My Latest Articles-->****
        InfoBox Visual Studio 2010 Extension
        Windows7 API Code Pack
        Simplify Code Using NDepend**

        1 Reply Last reply
        0
        • I ishwarya mahadevan

          Hi I want a numeric value to be added to the current date. the numeric value is provided dynamically. how do i do it? i tried the following but showing error : textbox1.text=now.date+textbox2.text i also tried : textbox1.text=now.date+val(textbox2.text) it is treating the + as concat operator and not as addition.

          J Offline
          J Offline
          JustWorking
          wrote on last edited by
          #4

          ishwarya mahadevan wrote:

          it is treating the + as concat operator and not as addition

          That is you are working with text as a string, you need to convert the string to datetime inorder to add the number of days dynamically.

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups