datepicker - Datetimepicker slowness in jquery: set date and time format -


i have drop down list , when changing value displaying date , other fields. executing 1s in 8gb , other pc 2g or 4g takes 4s execute code.

my code :

 obj ="2015-06-13 11:47:27"  var str = $.trim(obj).substr (0,$.trim(obj).lastindexof (" ") + 1);  var date = str.split("-");  var str1 = $.trim(obj).substr ($.trim(obj).lastindexof (" ") + 1,$.trim(obj).length);  var time = str1.split(":");  $("#date").datetimepicker ({     dateformat: 'yy-mm-dd h:i'   }).datetimepicker("setdate",new date(date[0],date[1]-1,date[2],time[0],time[1] )); 

i try refine code below code faster need value in date , time

$("#date").val($.datepicker.formatdate('yy-mm-dd ', $mydate)); 

im expecting like

   $("#date").val($.datepicker.formatdate('yy-mm-dd hh:mm', $mydate)); 

please me improve code.

i'll in here, it's easier set example. code below is, parses date simplified iso 8601 extended format subform (yyyy-mm-ddthh:mm:ss). requires blank space replaced t done using replace function. parsed date object injected datetimepicker value of "setdate".

obj = "2015-06-13 11:47:27"; dateobj = date.parse(obj.replace(" ", "t"));  $("#date").datetimepicker({     dateformat: 'yy-mm-dd h:i' }).datetimepicker("setdate", dateobj); 

Comments

Popular posts from this blog

facebook - android ACTION_SEND to share with specific application only -

python - Creating a new virtualenv gives a permissions error -

javascript - cocos2d-js draw circle not instantly -