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. General Programming
  3. C#
  4. Problem with JavaScript Date process

Problem with JavaScript Date process

Scheduled Pinned Locked Moved C#
helpjavascript
3 Posts 3 Posters 1 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.
  • K Offline
    K Offline
    kheer
    wrote on last edited by
    #1

    I want todays date in one textbox and in another textbox 15days incremented i have a Javascript code for getting date month Year function addDate() { TheDate = new Date(); var theMonth = TheDate.getMonth(); var theDay = TheDate.getDate(); var theYear = TheDate.getFullYear(); if (document.getElementById('Text1').value == '') { document.getElementById('Text1').value = theDay + '/' + theMonth + '/' + theYear ; } else { document.getElementById('Text1').value = theDay + '/' + theMonth + '/' + theYear ; } } I am unable to increment the date in second textbox help me to solve this problem.:confused:</x-turndown>

    L G 2 Replies Last reply
    0
    • K kheer

      I want todays date in one textbox and in another textbox 15days incremented i have a Javascript code for getting date month Year function addDate() { TheDate = new Date(); var theMonth = TheDate.getMonth(); var theDay = TheDate.getDate(); var theYear = TheDate.getFullYear(); if (document.getElementById('Text1').value == '') { document.getElementById('Text1').value = theDay + '/' + theMonth + '/' + theYear ; } else { document.getElementById('Text1').value = theDay + '/' + theMonth + '/' + theYear ; } } I am unable to increment the date in second textbox help me to solve this problem.:confused:</x-turndown>

      L Offline
      L Offline
      leppie
      wrote on last edited by
      #2

      kiranreddy wrote:

      help me to solve this problem

      You did not tell us your problem. Also this suspiciously looks like web stuff and not C#, try the ASP.NET forum.

      xacc.ide - now with TabsToSpaces support
      IronScheme - 1.0 beta 1 - out now!
      ((lambda (x) `((lambda (x) ,x) ',x)) '`((lambda (x) ,x) ',x))

      1 Reply Last reply
      0
      • K kheer

        I want todays date in one textbox and in another textbox 15days incremented i have a Javascript code for getting date month Year function addDate() { TheDate = new Date(); var theMonth = TheDate.getMonth(); var theDay = TheDate.getDate(); var theYear = TheDate.getFullYear(); if (document.getElementById('Text1').value == '') { document.getElementById('Text1').value = theDay + '/' + theMonth + '/' + theYear ; } else { document.getElementById('Text1').value = theDay + '/' + theMonth + '/' + theYear ; } } I am unable to increment the date in second textbox help me to solve this problem.:confused:</x-turndown>

        G Offline
        G Offline
        Guffa
        wrote on last edited by
        #3

        Use the getTime method to get the date in milliseconds, add the number of milliseconds in 15 days, and create a new Date object from the result. Note that the month value is zero based, so you have to add one to get the one based value that humans use.

        Despite everything, the person most likely to be fooling you next is yourself.

        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