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 8678505
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T20:44:19+00:00 2026-06-12T20:44:19+00:00

I want to add +1 if the date is sunday . Below code works

  • 0

I want to add +1 if the date is sunday. Below code works for the rest dates. But when I pass 30 sept 2012 I gives me 1 Sept 2012 instead of 1 Oct 2012 in dateMsg. What is wrong with the code?. Please guide. I guess I’l face same problem in all last date of the month.How to add 1 to whole date rather than just the day?

var monthName=convertMnthNoToName(freeLookEndDt.getMonth()+1);

    if (freeLookEndDt.getDay()==0) {

      var date=new Date(freeLookEndDt.getFullYear(),freeLookEndDt.getMonth(),
      freeLookEndDt.getDate()+1);
      var newmonthName=convertMnthNoToName(date.getMonth()+1);
      var dateMsg = date.getDate() + '-' + monthName + '-' + freeLookEndDt.getFullYear();

      document.forms[0].flEndDt.value=dateMsg;

    }

and convertMnthNoToName()

function convertMnthNoToName(val)
{
    if(val==01 || val==1)
    {
      val1="Jan";
    }
    if(val==02 || val==2)
    {
      val1="Feb";   
    }
    if(val==03 || val==3)
    {
      val1="Mar";   
    }
    if(val==04 || val==4)
    {
      val1="Apr";   
    }
    if(val==05 || val==5)
    {
      val1="May";   
    }
    if(val==06 || val==6)
    {
      val1="Jun";   
    }
    if(val==07 || val==7)
    {
      val1="Jul";   
    }
    if(val==08 || val==8)
    {
      val1="Aug";   
    }
    if(val==09 || val==9)
    {
      val1="Sep";   
    }
    if(val==10)
    {
      val1="Oct";   
    }
    if(val==11)
    {
      val1="Nov";   
    }
    if(val==12)
    {
      val1="Dec";   
    }

    return val1;
}

where freeLookEndDt = Sun Sep 30 00:00:00 UTC+0530 2012

  • 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-12T20:44:21+00:00Added an answer on June 12, 2026 at 8:44 pm

    u define newmonthName but use monthName. Thus it is using old month name. newmonthNameshould have changed

    you should just be able to do freeLookEndDt.setDate(freeLookEndDt.getDate()+1)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I use DatePickerDialog.OnDateSetListener that's works fine. I want to add date for 120 days
I want to add days to a date to get a new date in
I want to add some no. of days to get the future date. And
I want to get value in a date picker and add to textfield_date..I used
I want add UIGestureRecognizerDelegate to UIWebView,but failed. if [self.view addsubView:webView]; So UIWebView is ok,but
I want to add the current date/time to an XML document So i use
I want to add content to a MySQL table with current date and time.
I am currently developing a webpage, and I want to add date&time to my
I want to add one day to a particular date. How can I do
I want to add notification based on a user defined time and date. How

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.