jquery获取时间及处理
程序员文章站
2022-06-20 08:33:41
1、获取javascript 的时间使用内置的date函数完成
var mydate = new date();
mydate.getyear(); //获取当前年份(2位...
1、获取javascript 的时间使用内置的date函数完成
var mydate = new date(); mydate.getyear(); //获取当前年份(2位) mydate.getfullyear(); //获取完整的年份(4位,1970-????) mydate.getmonth(); //获取当前月份(0-11,0代表1月) mydate.getdate(); //获取当前日(1-31) mydate.getday(); //获取当前星期x(0-6,0代表星期天) mydate.gettime(); //获取当前时间(从1970.1.1开始的毫秒数) mydate.gethours(); //获取当前小时数(0-23) mydate.getminutes(); //获取当前分钟数(0-59) mydate.getseconds(); //获取当前秒数(0-59) mydate.getmilliseconds(); //获取当前毫秒数(0-999) mydate.tolocaledatestring(); //获取当前日期 var mytime=mydate.tolocaletimestring(); //获取当前时间 mydate.tolocalestring( ); //获取日期与时间
2、日期时间脚本库方法列表
date.prototype.isleapyear 判断闰年 date.prototype.format 日期格式化 date.prototype.dateadd 日期计算 date.prototype.datediff 比较日期差 date.prototype.tostring 日期转字符串 date.prototype.toarray 日期分割为数组 date.prototype.datepart 取日期的部分信息 date.prototype.maxdayofdate 取日期所在月的最大天数 date.prototype.weeknumofyear 判断日期所在年的第几周 stringtodate 字符串转日期型 isvaliddate 验证日期有效性 checkdatetime 完整日期时间检查 daysbetween 日期天数差
上一篇: PHP防止跨域提交表单
下一篇: Python多任务之线程