function DateUtil(){
this.url = "";
this.op={
partten:{mdy:"m/d/y",ymd:"y/m/d",dmy:"d/m/y"}
};
this.cdate = new Date();
}
DateUtil.prototype.updateDate=function(){
this.cdate = new Date();
};
DateUtil.prototype.setTime=function(v){
this.cdate.setTime(v);
};
DateUtil.prototype.getYear=function(){
return this.cdate.getFullYear();
};
DateUtil.prototype.getMonth=function(){
return this.cdate.getMonth()+1;
};
DateUtil.prototype.getDay=function(){
return this.cdate.getDate();
};
DateUtil.prototype.getFirstDayOfMonth=function(d){
var currentMonth = new Date(d.getTime())||new Date();
currentMonth.setDate(1);
return currentMonth;
};
DateUtil.prototype.getLastDayOfMonth=function(d){
var nextMonth = new Date(d.getTime())||new Date();
var month = nextMonth.getMonth();
nextMonth.setMonth(month+1);
nextMonth.setDate(0);
return nextMonth;
};
//对Date的扩展,将 Date 转化为指定格式的String
//月(M)、日(d)、小时(h)、分(m)、秒(s)、季度(q) 可以用 1-2 个占位符,
//年(y)可以用 1-4 个占位符,毫秒(S)只能用 1 个占位符(是 1-3 位的数字)
//例子:
//(new Date()).Format("yyyy-MM-dd hh:mm:ss.S") ==> 2006-07-02 08:09:04.423
//(new Date()).Format("yyyy-M-d h:m:s.S") ==> 2006-7-2 8:9:4.18
DateUtil.prototype.format = function (d,fmt) { //author: meizz
var o = {
"M+": d.getMonth() + 1, //月份
"d+": d.getDate(), //日
"h+": d.getHours(), //小时
"m+": d.getMinutes(), //分
"s+": d.getSeconds(), //秒
"q+": Math.floor((d.getMonth() + 3) / 3), //季度
"S": d.getMilliseconds() //毫秒
};
if (/(y+)/.test(fmt)) fmt = fmt.replace(RegExp.$1, (d.getFullYear() + "").substr(4 - RegExp.$1.length));
for (var k in o)
if (new RegExp("(" + k + ")").test(fmt)) fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length)));
return fmt;
};
DateUtil.prototype.getHours=function(){
return this.cdate.getHours();
};
DateUtil.prototype.getMinutes=function(){
return this.cdate.getMinutes();
};
DateUtil.prototype.getSeconds=function(){
return this.cdate.getSeconds();
};
DateUtil.prototype.getToday=function(){
return this.format(this.cdate, "yyyy-MM-dd");
};
/**
* 计算出相差的时间后的日期
* @param d 日期
* @param s 相差的时间
* @param t 类型:day天, month月, year年, hour, minute, second
*/
DateUtil.prototype.getNewDate=function(d, s, t){
if("year" == t){
var year = d.getFullYear() + s;
var strDate = year+"/"+this.format(d, "MM/dd hh:mm:ss");
return new Date(strDate);
}else if("month" == t){
var year = d.getFullYear();
var month = d.getMonth()+1 + s;
var strDate="";
if (month==0) {
strDate = (year-1)+"/"+12+"/"+this.format(d, "dd hh:mm:ss");
}else if (month>12) {
strDate = (year+1)+"/"+1+"/"+this.format(d, "dd hh:mm:ss");
}else {
strDate = year+"/"+month+"/"+this.format(d, "dd hh:mm:ss");
}
return new Date(strDate);
}else if("day" == t){
var lt = d.getTime() + s*24*60*60*1000;
return new Date(lt);
}else if("hour" == t){
var lt = d.getTime() + s*60*60*1000;
return new Date(lt);
}else if("minute" == t){
var lt = d.getTime() + s*60*1000;
return new Date(lt);
}else if("second" == t){
var lt = d.getTime() + s*1000;
return new Date(lt);
}
return d;
};
DateUtil.prototype.parseDate=function(s){
if(s != null && s != ""){
try{
if(typeof(s) == "string"){
s = s.replace(/-/g, "/");
return new Date(s);
}else if(typeof(s) == "number"){
return new Date(s);
}
}catch(e){
alert(e.message);
}
}
return null;
};
DateUtil.prototype.getCurrentTimeString=function(){
return this.getYear()+""+this.getMonth()+""+
this.getDay()+""+this.getHours()+""+
this.getMinutes()+""+this.getSeconds();
};
DateUtil.prototype.getWeek=function(date){
var week = 0;
var df = "mmddyy";
if(date==null || date =="" || typeof(date) == "undefined"){
date = this.getToday();
df = "yyMMdd";
}
date = date.replace(/\//g,"-");
week = $.ajax({
type:"get",
url:basePath+"/dateUtil/week/"+encodeURIComponent(date)+"/"+df,
cache:false,
async:false,
dataType:"text"
}).responseText;
return week;
};
DateUtil.prototype.getQuarter=function(date, format){
var month = 0;
if(date && typeof(date) == "string" && date != "" && format && format != ""){
var p = this.op.partten[format];
var index = p.indexOf("m");
var d = date.split("/");
if(index == 0){
month = parseInt(d[0],10);
}else{
month = parseInt(d[1],10);
}
}else if(date && typeof(date) == "object"){
month = date.getMonth();
}else if(date && typeof(date) == "number"){
month = date;
}else{
month = this.getMonth();
}
if(month % 3 == 0){
return month / 3;
}else{
return parseInt(month / 3 + 1);
}
};
DateUtil.prototype.getQuarterByMonth = function(m){
if(m % 3 == 0){
return m / 3;
}else{
return parseInt(m / 3 + 1);
}
};
/**
* 若date为空,则返回当前日期是周几,否则数据类型为string,格式都为m/d/y
* @param date
* @returns
*/
DateUtil.prototype.getDayOfWeek=function(date){
if(date && typeof(date) == "string"){
var d = date.split("/");
var md = new Date(parseInt(d[2]), parseInt(d[0]), parseInt(d[1]));
return md.getDay();
}else{
this.updateDate();
return this.getDay();
}
};
/**
* 得到一个日期所在周的开始时间和结束时间,不传参数为当前周
* @param date
* @returns {___anonymous5423_5464}
*/
DateUtil.prototype.getStartAndEndDayOf=function(date, type){
var today = date||new Date();
var startDate = "", endDate = "";
if(type == "day"){
startDate = this.format(today, "yyyy-MM-dd");
return {"startDate":startDate, "endDate":startDate};
}else if(type == "week"){
var dayOfweek = today.getDay();
var monday = new Date(today.getFullYear(), today.getMonth(), today.getDate()-dayOfweek+1);
var sunday = new Date(today.getFullYear(), monday.getMonth(), monday.getDate()+6);
startDate = this.format(monday, "yyyy-MM-dd");
endDate = this.format(sunday, "yyyy-MM-dd");
return {"startDate":startDate, "endDate":endDate};
}else if(type == "month"){
var monday = this.getFirstDayOfMonth(today);
var sunday = this.getLastDayOfMonth(today);
startDate = this.format(monday, "yyyy-MM-dd");
endDate = this.format(sunday, "yyyy-MM-dd");
return {"startDate":startDate, "endDate":endDate};
}else if(type == "quarter"){
var quarter = this.getQuarter(today, "");
startDate = this.format(new Date(today.getFullYear(), quarter*3-3, 1), "yyyy-MM-dd");
endDate = this.format(new Date(today.getFullYear(), quarter*3, 0), "yyyy-MM-dd");
return {"startDate":startDate, "endDate":endDate};
}else if(type == "year"){
startDate = today.getFullYear()+"-01-01";
endDate = today.getFullYear()+"-12-31";
return {"startDate":startDate, "endDate":endDate};
}else{
startDate = this.format(today, "yyyy-MM-dd");
return {"startDate":startDate, "endDate":startDate};
}
};
DateUtil.prototype.getPreDateForGapTime = function(date, type){
var today = this.parseDate(date)||new Date();
if(type.indexOf("pre") == 0){
type = type.replace("pre","");
var endDate = this.format(today, "yyyy-MM-dd");
if(type.toLowerCase() == "day"){
return {"startDate":endDate, "endDate":endDate};
}else if(type.toLowerCase() == "week"){
var startDate = this.format(this.getNewDate(today, -7, "day"), "yyyy-MM-dd");
return {"startDate":startDate, "endDate":endDate};
}else if(type.toLowerCase() == "month"){
var startDate = this.format(this.getNewDate(today, -1, "month"), "yyyy-MM-dd");
return {"startDate":startDate, "endDate":endDate};
}else if(type.toLowerCase() == "quarter"){
var startDate = this.format(this.getNewDate(today, -90, "day"), "yyyy-MM-dd");
return {"startDate":startDate, "endDate":endDate};
}else if(type.toLowerCase() == "year"){
var startDate = this.format(this.getNewDate(today, -1, "year"), "yyyy-MM-dd");
return {"startDate":startDate, "endDate":endDate};
}else{
return {"startDate":endDate, "endDate":endDate};
}
}else{
return this.getStartAndEndDayOf(date, type);
}
};
DateUtil.prototype.newgetPreDateForGapTime = function(date, type,i){
var today = this.parseDate(date)||new Date();
if(type.indexOf("pre") == 0){
type = type.replace("pre","");
if(type.toLowerCase() == "day" || type.toLowerCase() == "hour" || type.toLowerCase() == "minute"){
var startDate = this.format(this.getNewDate(today, 1*i, "day"), "yyyy-MM-dd");
var time=this.getStartAndEndDayOf(new Date(startDate), type.toLowerCase());
return {"startDate":time.startDate, "endDate":time.endDate};
}else if(type.toLowerCase() == "week"){
var startDate = this.format(this.getNewDate(today, 7*i, "day"), "yyyy-MM-dd");
var time=this.getStartAndEndDayOf(new Date(startDate), type.toLowerCase());
return {"startDate":time.startDate, "endDate":time.endDate};
}else if(type.toLowerCase() == "month"){
var startDate = this.format(this.getNewDate(today, 1*i, "month"), "yyyy-MM-dd");
var time=this.getStartAndEndDayOf(new Date(startDate), type.toLowerCase());
return {"startDate":time.startDate, "endDate":time.endDate};
}else if(type.toLowerCase() == "quarter"){
var startDate = this.format(this.getNewDate(today, 90*i, "day"), "yyyy-MM-dd");
var time=this.getStartAndEndDayOf(new Date(startDate), type.toLowerCase());
return {"startDate":time.startDate, "endDate":time.endDate};
}else if(type.toLowerCase() == "year"){
var startDate = this.format(this.getNewDate(today, 1*i, "year"), "yyyy-MM-dd");
var time=this.getStartAndEndDayOf(new Date(startDate), type.toLowerCase());
return {"startDate":time.startDate, "endDate":time.endDate};
}else{
return {"startDate":endDate, "endDate":endDate};
}
}else{
return this.getStartAndEndDayOf(date, type);
}
};
function isLeapYear(year) {
return (year % 400 == 0) || (year % 4 == 0 && year % 100 != 0);
}
/**
* 获取某一年份的某一月份的天数
*
* @param {Number} year
* @param {Number} month
*/
function getMonthDays(year, month) {
return [31, null, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31][month] || (isLeapYear(year) ? 29 : 28);
}
/**
* 获取某年的某天是第几周
* @param {Number} y
* @param {Number} m
* @param {Number} d
* @returns {Number}
*/
function getWeekNumber(y, m, d) {
var now = new Date(y, m - 1, d),
year = now.getFullYear(),
month = now.getMonth(),
days = now.getDate();
//那一天是那一年中的第多少天
for (var i = 0; i < month; i++) {
days += getMonthDays(year, i);
}
//那一年第一天是星期几
var yearFirstDay = new Date(year, 0, 1).getDay() || 7;
var week = null;
if (yearFirstDay == 1) {
week = Math.ceil(days / yearFirstDay);
} else {
days -= (7 - yearFirstDay + 1);
week = Math.ceil(days / 7) + 1;
}
return week;
}
var DUtil = new DateUtil();
this.url = "";
this.op={
partten:{mdy:"m/d/y",ymd:"y/m/d",dmy:"d/m/y"}
};
this.cdate = new Date();
}
DateUtil.prototype.updateDate=function(){
this.cdate = new Date();
};
DateUtil.prototype.setTime=function(v){
this.cdate.setTime(v);
};
DateUtil.prototype.getYear=function(){
return this.cdate.getFullYear();
};
DateUtil.prototype.getMonth=function(){
return this.cdate.getMonth()+1;
};
DateUtil.prototype.getDay=function(){
return this.cdate.getDate();
};
DateUtil.prototype.getFirstDayOfMonth=function(d){
var currentMonth = new Date(d.getTime())||new Date();
currentMonth.setDate(1);
return currentMonth;
};
DateUtil.prototype.getLastDayOfMonth=function(d){
var nextMonth = new Date(d.getTime())||new Date();
var month = nextMonth.getMonth();
nextMonth.setMonth(month+1);
nextMonth.setDate(0);
return nextMonth;
};
//对Date的扩展,将 Date 转化为指定格式的String
//月(M)、日(d)、小时(h)、分(m)、秒(s)、季度(q) 可以用 1-2 个占位符,
//年(y)可以用 1-4 个占位符,毫秒(S)只能用 1 个占位符(是 1-3 位的数字)
//例子:
//(new Date()).Format("yyyy-MM-dd hh:mm:ss.S") ==> 2006-07-02 08:09:04.423
//(new Date()).Format("yyyy-M-d h:m:s.S") ==> 2006-7-2 8:9:4.18
DateUtil.prototype.format = function (d,fmt) { //author: meizz
var o = {
"M+": d.getMonth() + 1, //月份
"d+": d.getDate(), //日
"h+": d.getHours(), //小时
"m+": d.getMinutes(), //分
"s+": d.getSeconds(), //秒
"q+": Math.floor((d.getMonth() + 3) / 3), //季度
"S": d.getMilliseconds() //毫秒
};
if (/(y+)/.test(fmt)) fmt = fmt.replace(RegExp.$1, (d.getFullYear() + "").substr(4 - RegExp.$1.length));
for (var k in o)
if (new RegExp("(" + k + ")").test(fmt)) fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length)));
return fmt;
};
DateUtil.prototype.getHours=function(){
return this.cdate.getHours();
};
DateUtil.prototype.getMinutes=function(){
return this.cdate.getMinutes();
};
DateUtil.prototype.getSeconds=function(){
return this.cdate.getSeconds();
};
DateUtil.prototype.getToday=function(){
return this.format(this.cdate, "yyyy-MM-dd");
};
/**
* 计算出相差的时间后的日期
* @param d 日期
* @param s 相差的时间
* @param t 类型:day天, month月, year年, hour, minute, second
*/
DateUtil.prototype.getNewDate=function(d, s, t){
if("year" == t){
var year = d.getFullYear() + s;
var strDate = year+"/"+this.format(d, "MM/dd hh:mm:ss");
return new Date(strDate);
}else if("month" == t){
var year = d.getFullYear();
var month = d.getMonth()+1 + s;
var strDate="";
if (month==0) {
strDate = (year-1)+"/"+12+"/"+this.format(d, "dd hh:mm:ss");
}else if (month>12) {
strDate = (year+1)+"/"+1+"/"+this.format(d, "dd hh:mm:ss");
}else {
strDate = year+"/"+month+"/"+this.format(d, "dd hh:mm:ss");
}
return new Date(strDate);
}else if("day" == t){
var lt = d.getTime() + s*24*60*60*1000;
return new Date(lt);
}else if("hour" == t){
var lt = d.getTime() + s*60*60*1000;
return new Date(lt);
}else if("minute" == t){
var lt = d.getTime() + s*60*1000;
return new Date(lt);
}else if("second" == t){
var lt = d.getTime() + s*1000;
return new Date(lt);
}
return d;
};
DateUtil.prototype.parseDate=function(s){
if(s != null && s != ""){
try{
if(typeof(s) == "string"){
s = s.replace(/-/g, "/");
return new Date(s);
}else if(typeof(s) == "number"){
return new Date(s);
}
}catch(e){
alert(e.message);
}
}
return null;
};
DateUtil.prototype.getCurrentTimeString=function(){
return this.getYear()+""+this.getMonth()+""+
this.getDay()+""+this.getHours()+""+
this.getMinutes()+""+this.getSeconds();
};
DateUtil.prototype.getWeek=function(date){
var week = 0;
var df = "mmddyy";
if(date==null || date =="" || typeof(date) == "undefined"){
date = this.getToday();
df = "yyMMdd";
}
date = date.replace(/\//g,"-");
week = $.ajax({
type:"get",
url:basePath+"/dateUtil/week/"+encodeURIComponent(date)+"/"+df,
cache:false,
async:false,
dataType:"text"
}).responseText;
return week;
};
DateUtil.prototype.getQuarter=function(date, format){
var month = 0;
if(date && typeof(date) == "string" && date != "" && format && format != ""){
var p = this.op.partten[format];
var index = p.indexOf("m");
var d = date.split("/");
if(index == 0){
month = parseInt(d[0],10);
}else{
month = parseInt(d[1],10);
}
}else if(date && typeof(date) == "object"){
month = date.getMonth();
}else if(date && typeof(date) == "number"){
month = date;
}else{
month = this.getMonth();
}
if(month % 3 == 0){
return month / 3;
}else{
return parseInt(month / 3 + 1);
}
};
DateUtil.prototype.getQuarterByMonth = function(m){
if(m % 3 == 0){
return m / 3;
}else{
return parseInt(m / 3 + 1);
}
};
/**
* 若date为空,则返回当前日期是周几,否则数据类型为string,格式都为m/d/y
* @param date
* @returns
*/
DateUtil.prototype.getDayOfWeek=function(date){
if(date && typeof(date) == "string"){
var d = date.split("/");
var md = new Date(parseInt(d[2]), parseInt(d[0]), parseInt(d[1]));
return md.getDay();
}else{
this.updateDate();
return this.getDay();
}
};
/**
* 得到一个日期所在周的开始时间和结束时间,不传参数为当前周
* @param date
* @returns {___anonymous5423_5464}
*/
DateUtil.prototype.getStartAndEndDayOf=function(date, type){
var today = date||new Date();
var startDate = "", endDate = "";
if(type == "day"){
startDate = this.format(today, "yyyy-MM-dd");
return {"startDate":startDate, "endDate":startDate};
}else if(type == "week"){
var dayOfweek = today.getDay();
var monday = new Date(today.getFullYear(), today.getMonth(), today.getDate()-dayOfweek+1);
var sunday = new Date(today.getFullYear(), monday.getMonth(), monday.getDate()+6);
startDate = this.format(monday, "yyyy-MM-dd");
endDate = this.format(sunday, "yyyy-MM-dd");
return {"startDate":startDate, "endDate":endDate};
}else if(type == "month"){
var monday = this.getFirstDayOfMonth(today);
var sunday = this.getLastDayOfMonth(today);
startDate = this.format(monday, "yyyy-MM-dd");
endDate = this.format(sunday, "yyyy-MM-dd");
return {"startDate":startDate, "endDate":endDate};
}else if(type == "quarter"){
var quarter = this.getQuarter(today, "");
startDate = this.format(new Date(today.getFullYear(), quarter*3-3, 1), "yyyy-MM-dd");
endDate = this.format(new Date(today.getFullYear(), quarter*3, 0), "yyyy-MM-dd");
return {"startDate":startDate, "endDate":endDate};
}else if(type == "year"){
startDate = today.getFullYear()+"-01-01";
endDate = today.getFullYear()+"-12-31";
return {"startDate":startDate, "endDate":endDate};
}else{
startDate = this.format(today, "yyyy-MM-dd");
return {"startDate":startDate, "endDate":startDate};
}
};
DateUtil.prototype.getPreDateForGapTime = function(date, type){
var today = this.parseDate(date)||new Date();
if(type.indexOf("pre") == 0){
type = type.replace("pre","");
var endDate = this.format(today, "yyyy-MM-dd");
if(type.toLowerCase() == "day"){
return {"startDate":endDate, "endDate":endDate};
}else if(type.toLowerCase() == "week"){
var startDate = this.format(this.getNewDate(today, -7, "day"), "yyyy-MM-dd");
return {"startDate":startDate, "endDate":endDate};
}else if(type.toLowerCase() == "month"){
var startDate = this.format(this.getNewDate(today, -1, "month"), "yyyy-MM-dd");
return {"startDate":startDate, "endDate":endDate};
}else if(type.toLowerCase() == "quarter"){
var startDate = this.format(this.getNewDate(today, -90, "day"), "yyyy-MM-dd");
return {"startDate":startDate, "endDate":endDate};
}else if(type.toLowerCase() == "year"){
var startDate = this.format(this.getNewDate(today, -1, "year"), "yyyy-MM-dd");
return {"startDate":startDate, "endDate":endDate};
}else{
return {"startDate":endDate, "endDate":endDate};
}
}else{
return this.getStartAndEndDayOf(date, type);
}
};
DateUtil.prototype.newgetPreDateForGapTime = function(date, type,i){
var today = this.parseDate(date)||new Date();
if(type.indexOf("pre") == 0){
type = type.replace("pre","");
if(type.toLowerCase() == "day" || type.toLowerCase() == "hour" || type.toLowerCase() == "minute"){
var startDate = this.format(this.getNewDate(today, 1*i, "day"), "yyyy-MM-dd");
var time=this.getStartAndEndDayOf(new Date(startDate), type.toLowerCase());
return {"startDate":time.startDate, "endDate":time.endDate};
}else if(type.toLowerCase() == "week"){
var startDate = this.format(this.getNewDate(today, 7*i, "day"), "yyyy-MM-dd");
var time=this.getStartAndEndDayOf(new Date(startDate), type.toLowerCase());
return {"startDate":time.startDate, "endDate":time.endDate};
}else if(type.toLowerCase() == "month"){
var startDate = this.format(this.getNewDate(today, 1*i, "month"), "yyyy-MM-dd");
var time=this.getStartAndEndDayOf(new Date(startDate), type.toLowerCase());
return {"startDate":time.startDate, "endDate":time.endDate};
}else if(type.toLowerCase() == "quarter"){
var startDate = this.format(this.getNewDate(today, 90*i, "day"), "yyyy-MM-dd");
var time=this.getStartAndEndDayOf(new Date(startDate), type.toLowerCase());
return {"startDate":time.startDate, "endDate":time.endDate};
}else if(type.toLowerCase() == "year"){
var startDate = this.format(this.getNewDate(today, 1*i, "year"), "yyyy-MM-dd");
var time=this.getStartAndEndDayOf(new Date(startDate), type.toLowerCase());
return {"startDate":time.startDate, "endDate":time.endDate};
}else{
return {"startDate":endDate, "endDate":endDate};
}
}else{
return this.getStartAndEndDayOf(date, type);
}
};
function isLeapYear(year) {
return (year % 400 == 0) || (year % 4 == 0 && year % 100 != 0);
}
/**
* 获取某一年份的某一月份的天数
*
* @param {Number} year
* @param {Number} month
*/
function getMonthDays(year, month) {
return [31, null, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31][month] || (isLeapYear(year) ? 29 : 28);
}
/**
* 获取某年的某天是第几周
* @param {Number} y
* @param {Number} m
* @param {Number} d
* @returns {Number}
*/
function getWeekNumber(y, m, d) {
var now = new Date(y, m - 1, d),
year = now.getFullYear(),
month = now.getMonth(),
days = now.getDate();
//那一天是那一年中的第多少天
for (var i = 0; i < month; i++) {
days += getMonthDays(year, i);
}
//那一年第一天是星期几
var yearFirstDay = new Date(year, 0, 1).getDay() || 7;
var week = null;
if (yearFirstDay == 1) {
week = Math.ceil(days / yearFirstDay);
} else {
days -= (7 - yearFirstDay + 1);
week = Math.ceil(days / 7) + 1;
}
return week;
}
var DUtil = new DateUtil();
发表评论
-
dataView 工具栏
2016-08-02 10:13 685http://echarts.baidu.com/echart ... -
js对字符串进行编码方法总结
2016-07-18 16:38 581在用javascript对URL字符串进行编码中,虽然esca ... -
==与===区别(两个等号与三个等号)
2016-06-17 16:55 10101、对于string,number等基础类型,==和===是有 ... -
jquery select取值,赋值操作
2016-03-31 17:24 560jquery select取值,赋值操作一、获取Select获 ... -
Spring+Websocket实现消息的推送
2016-01-31 15:59 2536本文主要有三个步骤 1、用户登录后建立websocket连接, ... -
jqgrid
2016-01-28 13:54 390待补待补待补待补 -
HTML5的WebSocket(待补)
2016-01-19 17:30 560认识HTML5的WebSocket 在HTML5规范中,我最喜 ... -
网站cookie.js
2016-01-19 09:34 453cookie.js jQuery.cookie = funct ... -
SVG--(待补)
2016-01-18 10:49 526SVG--(待补) -
prototype---(待补)
2016-01-15 14:58 463<html> <body> & ... -
template
2015-11-17 14:16 349(function(){ template = { ... -
jQuery的deferred对象详解
2015-11-17 09:15 437function getDatas(layerId){ v ... -
jQuery 阻止事件冒泡
2015-11-17 09:12 451http://www.cnblogs.com/jiqing90 ... -
typeof
2015-11-10 15:26 541JS中的变量是松散类型(即弱类型)的,可以用来保存任何类型的数 ... -
hashMap.js
2015-11-04 09:57 437function HashMap() { /** Map大 ... -
分页处理
2015-11-01 09:21 747select * from (SELECT rownum as ... -
前台传字符串导出word
2015-10-29 13:43 696package com.yunfengtech.common; ... -
隐藏,前台
2015-10-27 10:51 480$.ajax({ url:"../../s ... -
js对象定义
2015-10-23 17:18 569一,基本概念 1,自定 ... -
js 自定义的相当于LIST的对象
2015-10-23 17:18 548function Vector() { ...
相关推荐
总的来说,“很全的时间js代码”这个压缩包可能是JavaScript开发者的一个宝贵资源,它收集了多种时间处理的示例,涵盖了日期对象的使用、时间戳转换、日期格式化以及兼容性处理等多个方面,可以帮助开发者更高效地...
5. **HTML文件`日期时间JS控件.html`的可能内容** - 这个文件可能是演示或示例代码,包含了如何在HTML中创建一个自定义的JavaScript日期时间控件。可能包含HTML结构,JavaScript代码片段,以及可能的CSS样式定义。 ...
标题提到的"时间js文件"可能是指一个专门用于处理时间选择和显示的JavaScript库或者脚本。描述中的“asp.net中好用的选择时间的js脚本”暗示了这个脚本可能被设计为与ASP.NET框架集成,提供方便的时间选择功能。 在...
"只选择小时、分的时间JS时间控件"是专为这种需求设计的一个JavaScript插件,主要由`jquery-timepicker.js`文件提供功能支持。这个插件允许开发者在网页上创建一个能够限制用户仅选择小时和分钟的时间输入框,同时...
本文将基于"好用的时间js插件"这一主题,探讨一些常见的JavaScript时间插件及其使用技巧。 首先,让我们了解什么是时间插件。时间插件是为JavaScript设计的库或工具,它们扩展了标准的日期和时间处理能力,提供了更...
总结来说,"动态显示当前时间的js"是一种利用JavaScript Date对象和定时器功能实现网页上实时更新当前时间的技术。通过理解和应用这些知识,开发者可以创建各种动态时间显示功能,适应不同项目的需求。
"非常方便易用的时间控件,时间JS"是这样一款自编的JavaScript库,旨在解决开发者在寻找免费且易于操控的时间控件时遇到的问题。这款控件结合了前人的经验,提供了一种既美观又实用的解决方案。 首先,时间控件的...
标题“时间JS控件”暗示我们将探讨的是JavaScript实现的时间选择器。 "时间JS控件.zip"是一个压缩包,包含可能用于创建时间选择功能的资源。描述中提到这是在网上找到并共享的,意味着这些代码可能是开源的或者由...
标签中的"js时间插件"和"asp.net插件"说明这个插件不仅限于ASP.NET环境,也可以在其他使用JavaScript的项目中使用。而"js时间"标签则明确了插件的核心功能是关于时间处理。 在压缩包文件中,"DateTool"可能是指包含...
标题“动态系统时间 js”指的是使用JavaScript编程语言来创建一个实时更新的系统时间显示功能。JavaScript是一种广泛应用于网页和网络应用的脚本语言,尤其在客户端浏览器中的运用,它可以为网页添加交互性和实时性...
点击控件 选择日期时间 JavaScript脚本文件 C# .net
JavaScript(简称JS)是一种轻量级的解释型编程语言,常用于网页和网络应用开发,能够操作和控制网页中的元素,实现动态效果。在本例中,我们要讨论如何使用JavaScript来动态显示客户端机器的当前时间。 JavaScript...
在JavaScript(JS)中获取服务器时间是一个常见的需求,特别是在创建实时更新的应用或者需要与服务器保持时间同步的场景中。服务器时间通常比客户端浏览器的时间更准确,因为客户端的时间可能被用户手动调整。以下将...
在JavaScript编程语言中,处理日期和时间是一项常见的任务,尤其在构建交互式的Web应用程序时。"日历时间JavaScript"指的是使用JavaScript库或方法来创建、显示和操作日期及时间的用户界面,例如日历控件。在这个...
通过上述分析,我们可以看出,JavaScript提供了强大的日期和时间处理功能,可以轻松地获取当前时间并对其进行格式化输出。此外,通过使用定时器,我们还可以实现动态更新时间的功能,这对于开发实时显示时间的应用...
例如,当用户滚动页面时,JavaScript可以通过监听滚动事件来控制时间轴的可见性,或者在鼠标悬停在时间点上时显示详细信息。JavaScript库如jQuery可以简化这些操作,提供更流畅的用户体验。此外,如果时间轴需要动态...
在JavaScript(JS)编程中,处理时间和日期是常见的任务,特别是在构建动态网页或者前端应用时。"补零"是指在表示日期或时间时,如果数值为一位数,通常会将其前面补一个零以达到两位数的形式,使得显示更加整齐统一...
在本案例中,“时间线js 根据时间进度 显示节点位置”表明我们正在处理一个JavaScript实现的时间线组件,它能够动态更新,以反映时间的流逝和进度变化,并且能够在时间线上定位各个关键节点。 首先,我们需要理解...
将此文件上传到您的网站上,需要显示时间的地方加入: <script language="javascript" src="clock.js"> 显示的是用户本机的时间。如不需农历则去掉农历部份的函数。
在JavaScript(JS)编程中,实现一个时间拖动条功能是一项常见的需求,特别是在涉及到多媒体播放、视频剪辑或时间控制的场景中。本项目“JS时间拖动条”旨在模仿QQ影音中的视频剪辑拖动条,提供用户友好的交互体验。...