javascript - how to pass the manual time into the input type="time" in js -


i know fedup these kind of repeated questions still didn't find answer question please me solve this.. in advance.

html :

var start="10:30 pm";  $scope.edit={}    frtime=start.split("pm")[0];                 frtime = frtime.trim();                 frtime= $filter('date')(frtime, "hh:mm");                                  $scope.edit.fromtime=new date("2010-12-28t"+frtime+":00");
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>  <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.23/angular.min.js"></script>  <input type="time" ng-model="edit.fromtime">

it showing time in input type field in html. need 10.30 pm in input field.

the js date object has methods setting hours, minutes, etc:

var newdate = new date(); newdate.sethours(10,30,0) 

just create new date, set whatever value need to:

plunker

all methods here.


Comments

Popular posts from this blog

IF statement in MySQL trigger -

c++ - What does MSC in "// appease MSC" comments mean? -

javascript - Blogger related post gadget image Resize s72-c [ Need Expert Help ] -