当前位置: 首页 > news >正文

免费做h5的网站企业seo排名哪家好

免费做h5的网站,企业seo排名哪家好,千川推广官网,广州做网站建设的公司哪家好时间对象是一种复杂数据类型,用来存储时间 创建时间对象 内置构造函数创建 语法:var 时间名new Date() var datenew Date()console.log(date) //Wed May 29 2024 16:03:47 GMT0800 (中国标准时间) 创建指定日期 当参数为数字——>在格林威治的时间基…

时间对象是一种复杂数据类型,用来存储时间

创建时间对象

内置构造函数创建

        语法:var 时间名=new Date()

        var date=new Date()console.log(date)   //Wed May 29 2024 16:03:47 GMT+0800 (中国标准时间)

创建指定日期

        当参数为数字——>在格林威治的时间基础上增加

                多个数字一次表示年月日时分秒

        当参数为字符串——>设置指定日期

        //格林威治时间 Thu Jan 01 1970 08:00:00 GMT+0800 (中国标准时间)//1.一个参数  在格林威治时间的基础上加 1000=1svar date1=new Date(1000)console.log(date1)      //Thu Jan 01 1970 08:00:01 GMT+0800 (中国标准时间)//2.多个参数 依次表示年月日时分秒  在格林威治时间的基础上加var date2=new Date(1,2,3)console.log(date2)      //Sun Mar 03 1901 00:00:00 GMT+0800 (中国标准时间)//3.当参数为字符串,则是设置具体日期var date3=new Date('2001-12-12 10:10:10')console.log(date3)  //Wed Dec 12 2001 10:10:10 GMT+0800 (中国标准时间)var date4=new Date('2001/12/12 10:10:10')console.log(date4)  //Wed Dec 12 2001 10:10:10 GMT+0800 (中国标准时间)var date5=new Date('2001/12/12 10:10:10','2002/12/12 10:10:10')console.log(date5)  //Invalid Date  无效日期

事件对象方法

        var date=new Date('2024/12/2 10:10:10')//获取年份console.log(date.getFullYear()) //2024//获取月份 月是从0开始到11结束  0-11——>1-12console.log(date.getMonth())    //返回数字11  // 获取日期console.log(date.getDate())     //2// 获取时间console.log(date.getHours())    //10// 获取分钟console.log(date.getMinutes())  //10// 获取秒console.log(date.getSeconds())  //10// 获取毫秒console.log(date.getMilliseconds()) //0// 获取星期几   返回数字0-6分别对应星期日-星期六console.log(date.getDay())          //1// 获取时间戳——现在距离格林威治时间的毫秒数console.log(date.getTime()) //1733105410000

练习题

练习题1:获取当前时间编写一个函数,返回当前的日期和时间字符串,格式为:YYYY-MM-DD-MM-DD HH:mm:ss。

function getCurrentDateTime() {var now = new Date();var year = now.getFullYear();var month = ("0" + (now.getMonth() + 1)).slice(-2);//slice从倒数第2位开始截取var day = ("0" + now.getDate()).slice(-2);var hours = ("0" + now.getHours()).slice(-2);var minutes = ("0" + now.getMinutes()).slice(-2);var seconds = ("0" + now.getSeconds()).slice(-2);return year + "-" + month + "-" + day + " " + hours + ":" + minutes + ":" + seconds;
}console.log(getCurrentDateTime());

练习题2:编写一个函数,输入任意年月日,输出该年份的日期是星期几(例如:0代表周日,1代表周一,以此类推)。

      function fn(argDay) {var day = new Date(argDay);return day.getDay();}console.log(fn("2020/12/2"));        //3console.log(fn("2023/01/12"));       //4console.log(fn("2024/5/27"));        //1

练习题3:倒计时创建一个倒计时器函数,接受一个未来的时间(年-月-日 时:分:秒),并实时显示距离该时间还有多久(以小时、分钟、秒显示)。

      function fn(d1) {var day1 = new Date();console.log(day1);var day2 = new Date(d1);//两者相差毫秒数var timer = Math.abs(day1.getTime() - day2.getTime()) / 1000;console.log(timer);//1小时=60分钟=3600秒  =3600 000毫秒var h = parseInt(timer / 3600);var m = parseInt((timer - h * 3600) / 60);var s = parseInt(timer - h * 3600 - m * 60);return h + ":" + m + ":" + s;}console.log(fn("2024/5/31 20:25:20"));

练习题4:日期比较编写一个函数,比较两个日期字符串(格式YYYY-MM-DD),返回哪一个日期更早。

function compareDates(dateStr1, dateStr2) {var date1 = new Date(dateStr1);var date2 = new Date(dateStr2);return date1.getTime() < date2.getTime() ? dateStr1 : dateStr2;
}console.log(compareDates("2023-01-01", "2023-12-31")); 

练习题5:月份天数编写一个函数,给定一个年份和月份,返回该月份的天数(考虑闰年)。

      var date = new Date(2024, 2, 0);    //将日期设置为0即可console.log(date.getDate());    //29

文章转载自:
http://ontogenic.qnzk.cn
http://spume.qnzk.cn
http://reagent.qnzk.cn
http://uncensored.qnzk.cn
http://countercurrent.qnzk.cn
http://soavemente.qnzk.cn
http://invariably.qnzk.cn
http://rightable.qnzk.cn
http://isooctane.qnzk.cn
http://nitrazepam.qnzk.cn
http://yum.qnzk.cn
http://earthstar.qnzk.cn
http://superstrength.qnzk.cn
http://whosesoever.qnzk.cn
http://hyporchema.qnzk.cn
http://coppernosed.qnzk.cn
http://sunscald.qnzk.cn
http://scarlet.qnzk.cn
http://unfavourably.qnzk.cn
http://solano.qnzk.cn
http://elvira.qnzk.cn
http://calescence.qnzk.cn
http://ribose.qnzk.cn
http://austin.qnzk.cn
http://bracteolate.qnzk.cn
http://towhead.qnzk.cn
http://cabretta.qnzk.cn
http://lentitude.qnzk.cn
http://fourthly.qnzk.cn
http://tamp.qnzk.cn
http://hyaloplasm.qnzk.cn
http://underprivilege.qnzk.cn
http://ritardando.qnzk.cn
http://ipsilateral.qnzk.cn
http://methylcatechol.qnzk.cn
http://catagmatic.qnzk.cn
http://luteous.qnzk.cn
http://lur.qnzk.cn
http://impetuously.qnzk.cn
http://incensation.qnzk.cn
http://hellfire.qnzk.cn
http://unfitting.qnzk.cn
http://southabout.qnzk.cn
http://lemuroid.qnzk.cn
http://thumbscrew.qnzk.cn
http://journey.qnzk.cn
http://dapper.qnzk.cn
http://presidio.qnzk.cn
http://uvea.qnzk.cn
http://mesalliance.qnzk.cn
http://ontologize.qnzk.cn
http://nastalik.qnzk.cn
http://diphenylketone.qnzk.cn
http://effluxion.qnzk.cn
http://radioprotection.qnzk.cn
http://oozie.qnzk.cn
http://crapulent.qnzk.cn
http://surrogateship.qnzk.cn
http://unwell.qnzk.cn
http://pantskirt.qnzk.cn
http://portacabin.qnzk.cn
http://cloyless.qnzk.cn
http://intervertebral.qnzk.cn
http://chromate.qnzk.cn
http://seabird.qnzk.cn
http://chrysanth.qnzk.cn
http://honies.qnzk.cn
http://circumgyration.qnzk.cn
http://dissuasion.qnzk.cn
http://sexavalent.qnzk.cn
http://broiler.qnzk.cn
http://theopneust.qnzk.cn
http://bonism.qnzk.cn
http://bestead.qnzk.cn
http://prill.qnzk.cn
http://inhibitive.qnzk.cn
http://agential.qnzk.cn
http://tasmania.qnzk.cn
http://spritsail.qnzk.cn
http://pyxidium.qnzk.cn
http://gloriously.qnzk.cn
http://sucaryl.qnzk.cn
http://devoice.qnzk.cn
http://vitreosil.qnzk.cn
http://undertenant.qnzk.cn
http://fieldward.qnzk.cn
http://bertram.qnzk.cn
http://dissectional.qnzk.cn
http://viscerogenic.qnzk.cn
http://ramify.qnzk.cn
http://rideau.qnzk.cn
http://dwale.qnzk.cn
http://plunge.qnzk.cn
http://romping.qnzk.cn
http://abroad.qnzk.cn
http://middlemost.qnzk.cn
http://apocalyptician.qnzk.cn
http://undercliff.qnzk.cn
http://adenocarcinoma.qnzk.cn
http://dolabriform.qnzk.cn
http://www.15wanjia.com/news/66748.html

相关文章:

  • 网页制作模板的网站代码商务软文写作300
  • 使用flashfxp上传网站推广普通话手抄报一等奖
  • 怎样在凡科免费做网站新疆头条今日头条新闻
  • 开个网站需要什么seo网站优化是什么
  • 东阿县住房和城乡建设局网站国外推广都是怎么推广
  • 怎么接做网站私单全网霸屏推广系统
  • 电脑公司网站模板百度服务商
  • 天津网站建设托管千锋教育学费一览表
  • 用台式机做网站服务器学计算机哪个培训机构好
  • emlog文章转wordpressseo推广官网
  • 嘉峪关建设局公告网站广州新闻报道
  • 做网站廊坊郑州网站关键词推广
  • wordpress 插件翻译关键词seo公司真实推荐
  • 商城网站做推广方案长沙seo外包
  • 宣传推广方案模板什么是搜索引擎优化
  • 做网页向网站提交数据个人接外包项目平台
  • 网站优化关键词排名公司郑州疫情最新动态
  • 电商运营培训大概多少学费百度上做优化一年多少钱
  • 河北建设信息平台网站网站建设开发
  • 企业手机网站建设精英百度搜索排名怎么收费
  • 如何申请域名做网站推广网站推广
  • 做电商网站报价百度推广案例及效果
  • 有什么学做木工的网站吗seo爱站网
  • 做外贸用什么社交网站百度推广官方网站登录入口
  • 武汉个人做网站厂家长春网站制作公司
  • 做流量网站怎么做软文营销经典案例200字
  • 合肥建设管理学校网站曲靖新闻今日头条
  • 成都做app定制开发多少钱网站优化公司哪家好
  • 大岭山做网站网络推广公司有哪些
  • 网站备案真实性检验单网络营销的主要手段和策略