Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>JS Bin</title>
  
  
    <link rel="stylesheet" href="//code.jquery.com/ui/1.11.4/themes/smoothness/jquery-ui.css">
  <script src="//code.jquery.com/jquery-1.10.2.js"></script>
  <script src="//code.jquery.com/ui/1.11.4/jquery-ui.js"></script>
      <script type="text/javascript" src="http://www.datejs.com/build/date.js"></script>
  <link rel="stylesheet" href="/resources/demos/style.css">
<p>From:   <input type="text" id="to">  <div id="datepicker"></div> <p>To: <input type="text" id="from"><div id="datepicker1"></div>
  
    
  
</head>
<body>
  
  
</body>
</html>
  
 
    
 
$(function() {
    $('#datepicker').datepicker({
        dateFormat: 'dd-mm-yy',
        onSelect: function(datetext){
            var date = $(this).datepicker('getDate');
            
            var d1 = new Date(); // for now
            date1 = d1.toString(" hh:mm tt");
          
          datetext = date.toString("dd-MM-yyyy");
            $('#to').val(datetext + date1);
        },
    });
    });
$(function() {
    $('#datepicker1').datepicker({
        dateFormat: 'dd-mm-yy',
        onSelect: function(datetext){
          
          var d2 = $(this).datepicker('getDate');
          
          var today = new Date();
          today.setHours(today.getHours()+4);
          date2 = today.toString(" hh:mm tt");
          
            datetext = d2.toString("dd-MM-yyyy");
            
            $('#from').val(datetext + date2);
        },
    });
    });
Output

This bin was created anonymously and its free preview time has expired (learn why). — Get a free unrestricted account

Dismiss x
public
Bin info
PunitYopro
0viewers