Show Financial Year using JQuery Datepicker

  1. <html>  
  2.   
  3. <head>  
  4.     <script type="text/javascript" src="http://code.jquery.com/jquery-1.8.3.js"></script>  
  5.     <link rel="stylesheet" href="http://code.jquery.com/ui/1.9.1/themes/base/jquery-ui.css" />  
  6.     <script src="http://code.jquery.com/ui/1.9.1/jquery-ui.js"></script>  
  7.     <script type="text/javascript">  
  8.         $(function()  
  9.         {  
  10.             var year;  
  11.             $("#datepicker1").datepicker(  
  12.             {  
  13.                 onSelect: function(dateText, inst)  
  14.                 {  
  15.                     var date = $(this).datepicker('getDate'),  
  16.                         day = date.getDate(),  
  17.                         month = date.getMonth(),  
  18.                         year = date.getFullYear();  
  19.                     year1 = date.getFullYear();  
  20.                     if (month < 3)  
  21.                     {  
  22.                         yearyear = year - 1;  
  23.                         year1year1 = year1.toString().substring(2);  
  24.                     }  
  25.                     else  
  26.                     {  
  27.                         yearyear = year;  
  28.                         year1 = (year1 + 1).toString().substring(2);;  
  29.                     }  
  30.                     $("#datepicker1").val(year + '-' + year1);  
  31.                 },  
  32.             });  
  33.         });  
  34.     </script>  
  35. </head>  
  36.   
  37. <body>  
  38.     <input type="text" id="datepicker1" /> </body>  
  39.   
  40. </html>