41 lines
995 B
JavaScript
41 lines
995 B
JavaScript
function DateUtil() {
|
|
}
|
|
|
|
|
|
DateUtil.getFullYear = function(date) {
|
|
return date.getFullYear();
|
|
}
|
|
|
|
DateUtil.getFullMonth = function(date) {
|
|
return StringUtil.getNumberStartWithZero(date.getMonth() + 1, 2)
|
|
}
|
|
|
|
DateUtil.getFullDate = function(date) {
|
|
return StringUtil.getNumberStartWithZero(date.getDate(), 2);
|
|
}
|
|
|
|
DateUtil.getFullHours = function(date) {
|
|
return StringUtil.getNumberStartWithZero(date.getHours(), 2);
|
|
}
|
|
|
|
DateUtil.getFullMinutes = function(date) {
|
|
return StringUtil.getNumberStartWithZero(date.getMinutes(), 2);
|
|
}
|
|
|
|
DateUtil.getFullSeconds = function(date) {
|
|
return StringUtil.getNumberStartWithZero(date.getSeconds(), 2);
|
|
}
|
|
|
|
|
|
DateUtil.getYYYYMMDD = function(date) {
|
|
// return date.toISOString().slice(0,10);
|
|
return DateUtil.getFullYear(date) + "-"
|
|
+ DateUtil.getFullMonth(date) + "-"
|
|
+ DateUtil.getFullDate(date);
|
|
}
|
|
|
|
DateUtil.getHHMMSS = function(date) {
|
|
return DateUtil.getFullHours(date) + ":"
|
|
+ DateUtil.getFullMinutes(date) + ":"
|
|
+ DateUtil.getFullSeconds(date);
|
|
} |