/**
* 格式化时间
*/
tool.formatTime = function (value) {
if (value && value > 0) {
return new Date(parseInt(value)).format('yyyy-MM-dd hh:mm:ss');
} else {
return '-';
}
}
/**
* 格式化时间
*/
tool.formatTimeNoS = function (value) {
if (value && value > 0) {
return new Date(parseInt(value)).format('yyyy-MM-dd hh:mm');
} else {
return '-';
}
}
/**
* 格式化时间时分秒
*/
tool.formatTimes = function (value) {
if (value) {
a Date new new return (the parseInt (value)) the format. ( 'HH: mm: SS');
} the else {
return '-';
}
}
/ **
* date time format
* /
tool.formatTimeYmd = function (value ) {
IF (value) {
. new new return a date (the parseInt (value)) the format ( 'the MM-dd-YYYY');
} the else {
return '-';
}
}
/ **
* time of day of the formula
* /
Tool = function .formatTimeMd (value) {
IF (value) {
return new new a Date (the parseInt (value)) the format ( 'the MM-dd');.
} the else {
return '-';
}
}
/ **
* time division of formula
* /
tool.formatTimeHm = function (value) {
if (value) {
return new Date(parseInt(value)).format('hh:mm');
} else {
return '-';
}
}
/ **
* When the second conversion all day every minute
* /
tool.formatSecond = function (value) {
var = secondTime the parseInt (value); // second
var minuteTime = 0; // sub
var hourTime = 0; // h
var dayTime = 0; // day
if (secondTime> 60) {// if more than 60 seconds, to an integer number of seconds
// Get minutes, 60 divided by an integer and the integer minutes to give
minuteTime = parseInt (secondTime / 60) ;
// Get the number of seconds, seconds taken She give integer seconds
secondTime = the parseInt (secondTime 60%);
// if more than 60 minutes, minutes to hours to convert the
IF (minuteTime> 60) {
// get the hours, minutes acquires by 60 hours to give the whole
hourTime = parseInt (minuteTime / 60) ;
take She divided // Get hours after, taking 60 minutes divided by acquiring She divided
minuteTime = the parseInt (minuteTime 60%);
}
IF (hourTime> 24) {
// Get days, divided by 24 days, to obtain an integer number of days
DayTime = the parseInt (hourTime / 24);
// get the remainder take days hours
hourTime = the parseInt (hourTime 24%);
}
}
var Result = "" + parseInt (secondTime) + " s";
if (minuteTime > 0) {
result = "" + parseInt(minuteTime) + "分" + result;
}
if (hourTime > 0) {
result = "" + parseInt(hourTime) + "小时" + result;
}
if (dayTime > 0) {
result = parseInt(dayTime) + "天" + result;
}
return result;
}