ui={ view : "datepicker" , id : "Date" , labelWidth : 35 , format : "%Y-%m-%d" , width : 250 , }, var myformat = webix . Date . dateToStr ( "%Y-%m-%d" ); //時間的形式 var date = myformat ( new Date ()); //當天時間的轉換 $$ ( "Date" ). setValue ( date ); //產生新的時間 webix . Date . add(當天 日期,數量,單位) var weekdate = webix . Date . add ( new Date (), - 1 , "week" ) var monthdate = webix . Date . add ( new Date (), - 1 , "month" ) //修改時間格式 var weekdate = myformat ( webix . Date . add ( new Date (), - 1 , "week" )) var monthdate = myformat ( webix . Date . add ( new Date (), - 1 , "month" )) //取得時間的字串 var daystr= $$ ( 'Date' ). data . text; //day的型態是String //將字串轉成時間 var day = new Date ( daystr ); // Thu Jun 04 2020 08:00:00 GMT+0800 (台北標準時間) / 不带new操作符,像一个函数一样调用。它将忽略所有传入的参数,并返回当前日期和时间的一个字符串表示。 new Date (); // 可接受一个数字参数,该参数表示设定时间与1970年1月1日0点之间的毫秒数。