Win a copy of High Performance Python for Data Analytics this week in the Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Bear Bibeault
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Jj Roberts
  • Carey Brown
Bartenders:
  • salvin francis
  • Frits Walraven
  • Piet Souris

date function to select past dates to today

 
Ranch Hand
Posts: 69
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Team,

Is there date function to select past dates to today or disable the future dates in calendar ?

Thanks

Kaushik
 
Marshal
Posts: 71752
312
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
There probably is, but you haven't explained what you want very well.
 
Master Rancher
Posts: 3760
49
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Is this some sort of user interface, for example?  Are you talking about a calendar that is visibly displayed to the user?  Or a java.util.Calendar object that is used to manipulate dates?  Or something else?  Can you tell us more about what you're doing before you try to disable some dates?
 
Tanka Banerjee
Ranch Hand
Posts: 69
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Mike Simmons wrote:Is this some sort of user interface, for example?  Are you talking about a calendar that is visibly displayed to the user?  Or a java.util.Calendar object that is used to manipulate dates?  Or something else?  Can you tell us more about what you're doing before you try to disable some dates?



Yes User Interface developed in JavaScript to check the datepicker, the file name has been bootstrap-datepicker.js, .ear user interface that has been developed


//Kaushik
  $(element).ready(function () {
     var currentDate = new Date();
     $('.disableFuturedate').datepicker({
     format: 'dd/mm/yyyy',
     autoclose:true,
     endDate: "currentDate",
     maxDate: currentDate
     }).on('changeDate', function (ev) {
        $(this).datepicker('hide');
     });
     $('.disableFuturedate').keyup(function () {
        if (this.value.match(/[^0-9]/g)) {
           this.value = this.value.replace(/[^0-9^-]/g, '');
        }
     });
  });
//Kaushik

This is the code that has been written by me
 
Campbell Ritchie
Marshal
Posts: 71752
312
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Don't use Date, nor Calendar. Look in the Java™ Tutorials to see what has superseded them.
 
Campbell Ritchie
Marshal
Posts: 71752
312
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Norm has pointed out that might not be Java® code. Are you writing Java® or Javascript?
 
Marshal
Posts: 3355
492
Android Eclipse IDE TypeScript Redhat MicroProfile Quarkus Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Is your question related to the jQuery Datepicker widget?
 
And will you succeed? Yes you will indeed! (98 and 3/4 % guaranteed) - Seuss. tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic