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

  • SEARCH
  • Home
  • 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 9090423
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T22:22:06+00:00 2026-06-16T22:22:06+00:00

I have a .ctp page .In that there have a button to load a

  • 0

I have a .ctp page .In that there have a button to load a div.

In that loaded div there have some datepickers..

The datepickers are loaded correctly.But i need to add 6 month to each date when i selected from datepickers.

This is my code:

<script type="text/javascript">
    $(function() {
        var cnt = $("#cnt").val();
        for(var i =0;i<cnt;i++){
            $( "#date_"+i ).datepicker({showButtonPanel: true, changeMonth: true, changeYear: true, minDate: "0", maxDate: "+10Y",dateFormat: "dd/mm/yy",
                         onSelect: function(dateText, instance) {
                        date = $.datepicker.parseDate(instance.settings.dateFormat, dateText, instance.settings);
                        date.setMonth(date.getMonth() + 6);
                        alert(date);
                    }
            });
            $( "#format" ).change(function() {
                $( "#date_"+i ).datepicker( "option", "dateFormat", $( this ).val() );
            });
        }
    });
</script>

Here when i select a date from id date_0 datepicker.
Then it displays date as Tue Jul 30 2013 00:00:00 GMT+0530 (India Standard Time).

But i need to alert as 30/7/2013.

How can i do this?

The date adding is correct but date format need to change?
Give me a solution?

  • 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-16T22:22:08+00:00Added an answer on June 16, 2026 at 10:22 pm

    The jQueryUI date picker has a built-in date formatting function called $.datepicker.formatDate.

    onSelect: function(dateText, instance) {
        var date = $(this).datepicker('getDate');
        date.setMonth(date.getMonth() + 6);
        var str = $.datepicker.formatDate("dd/mm/yy", date);
        alert(str);
    }
    

    See above how you can use $(this).datepicker('getDate') to extract the current Date object from the datepicker. regardless of its current format.

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

Sidebar

Related Questions

I have a login form that appears on all pages (Layout/default.ctp) and I want
I have a page that is supposed to render as a pdf with the
I have a method in my controller that handles generic page requests, meant for
I am using CakePHP 1.3 I have a static page called temp.ctp located at
I want to $this->Session->setFlash('text'); $this->redirect('page'); but the message is not displayed. I have included
I have installed Async-CTP-v3 for using new feature of C# 5 but when I
I have a static page that I want to serve so I made a
I have one page website, on homepage(Layout/default.ctp) I have 2 forms, subscribe and contact
I have some redirects in place from our previous site that used CakePHP. The
I have a addstudent.ctp file to add students echo $this->Form->create('Student'); echo $this->Form->input('FirstName'); echo $this->Form->input('LastName');

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.