Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9242557
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T08:36:15+00:00 2026-06-18T08:36:15+00:00

– I have a dropdown List on which there are some options from which

  • 0

– I have a dropdown List on which there are some options from which user can select one.

– Options are 1 day, 1 week, 2 weeks, 1 month and 6 months

– Now when I select option 1 day, today’s date should be incremented by one and next date is shown.

– If I select 1 week, the date falling after one week should be shown.

– Now the problem is when I select an option it sometimes shows date greater than 30/31.

– I use below javacript function:

 function select_duration(ddlcupon) {

            var skillsSelect = document.getElementById("ddlcupon");
            var selectedText = skillsSelect.options[skillsSelect.selectedIndex].text;

            if (selectedText == "1 Day") {

                var currentTime = new Date();
                var month = currentTime.getMonth() + 1;
                var day = currentTime.getDate() + 1;
                var year = currentTime.getFullYear();
                var exdate = month + "/" + day + "/" + year;

                document.getElementById('<%=txtEventDate.ClientID%>').value = exdate.toString();


            }
            if (selectedText == "1 Week") {

                var currentTime = new Date();
                var month = currentTime.getMonth() + 1;
                var day = currentTime.getDate() + 7;
                var year = currentTime.getFullYear();
                var exdate = month + "/" + day + "/" + year;

                document.getElementById('<%=txtEventDate.ClientID%>').value = exdate.toString();
            }
            if (selectedText == "2 Weeks") {

                var currentTime = new Date();
                var month = currentTime.getMonth() + 1;
                var day = currentTime.getDate() + 14;
                var year = currentTime.getFullYear();
                var exdate = month + "/" + day + "/" + year;
                document.getElementById('<%=txtEventDate.ClientID%>').value = exdate.toString();
            }
            if (selectedText == "1 Month") {

                var currentTime = new Date();
                var month = currentTime.getMonth() + 2;
                var day = currentTime.getDate();
                var year = currentTime.getFullYear();
                var exdate = month + "/" + day + "/" + year;
                document.getElementById('<%=txtEventDate.ClientID%>').value = exdate.toString();
            }
            if (selectedText == "6 Months") {

                var currentTime = new Date();
                var month = currentTime.getMonth() + 7;
                var day = currentTime.getDate();
                var year = currentTime.getFullYear();
                var exdate = month + "/" + day + "/" + year;
                document.getElementById('<%=txtEventDate.ClientID%>').value = exdate.toString();
            }

– Can someone help me in getting a proper date?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T08:36:16+00:00Added an answer on June 18, 2026 at 8:36 am

    try using this

    var dt1 = new Date();    
    var dt2 = new Date(dt1.getTime() + (86400000 * numberOfDay) );
    

    if your date is incremented by one day try

    var dt2 = new Date(dt1.getTime() + (86400000 * 1 ) ); //so on
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am reading some og tags from sites but I can't seem to decode
We have a title <title>Text &#8211; text</title> I want to change it with jquery
I am currently scraping some data from the internet and converting into xml documents.
We have different types of hyphens/dashes (in some text) populated in db. Before comparing
Have a webpage that will be viewed by mainly IE users, so CSS3 is
So to start, I have an array of XML files. These files need to
Here is the link to the offending page: http://www.wrightspecialty.com/brokers-agents-questionnaire.html?view=foxcontact There's a limitation to the
An extension to my previous question: Text cleaning and replacement: delete \n from a
I have a simple restful service that transforms a JAXB-anntotated beans to response XML
i have this code: <?php $valid_ext = array(pdf, doc); $args = array( 'post_type' =>

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.