首页 > 其他分享 >前端 CST和GMT+0800时间转换(js/vue/react/jsp通用)

前端 CST和GMT+0800时间转换(js/vue/react/jsp通用)

时间:2022-12-27 16:13:57浏览次数:46  
标签:00 vue getHours 0800 Number js beginTime CST endTime

             this.beginTime="2031-03-20 00:00:00"
             this.endTime="2031-03-20 00:00:00"

            this.beginTime=new Date(this.beginTime)
            this.endTime=new Date(this.endTime)

            // CST和GMT+0800时间转换
            this.beginTime=this.beginTime.getFullYear()+"-"+Number(this.beginTime.getMonth() + 1)+"-"+this.beginTime.getDate()+" "+
                Number(this.beginTime.getHours()>13?this.beginTime.getHours()-14:this.beginTime.getHours()+10)
            +":"+this.beginTime.getMinutes()
            this.endTime=this.endTime.getFullYear()+"-"+Number(this.endTime.getMonth() + 1)+"-"+this.endTime.getDate()+" "+
                Number(this.endTime.getHours()>13?this.endTime.getHours()-14:this.endTime.getHours()+10)+":"+this.endTime.getMinutes()

重点:

 Number(.getHours()>13?.getHours()-14:.getHours()+10)

标签:00,vue,getHours,0800,Number,js,beginTime,CST,endTime
From: https://www.cnblogs.com/naitang/p/17008259.html

相关文章

  • nodejs 接收参数,js前端传参方法
    nodejs//接口:查询检测结果req.query接收router.get('/getDetectionResult',(req,res)=>{console.log(req.query.id);constconn=mysql.createConnection(......
  • 不积跬步,无以至千里【7】【vue】
    1.vue生命周期(父子组件)   2.computed/methods/watch的区别●computed计算属性:依赖其它属性值,并且computed的值有缓存,只有它依赖的属性值发生改变,下一......
  • js判断空对象的方法
    一、将对象转为字符串比较这是最容易想到的方法,主要使用JSON.stringify()这个方法对对象进行强转:vara={};varb=newObject();console.log(JSON.stringify(a)=="{}")......
  • GO json.Unmarshal() 解析不区分json字段的大小写
    GOjson.Unmarshal()解析不区分json字段的大小写demopackagemainimport( "encoding/json" "fmt")typeDemostruct{ ABDstring`json:"ABD"`}typeDem......
  • js获取url参数
    <head></head><body></body><scriptsrc="http://code.jquery.com/jquery-1.11.1.min.js"></script><Scriptlanguage="javascript">$(window).load(function(){......
  • vue3传值
    https://blog.csdn.net/H_114/article/details/122420402?spm=1001.2101.3001.6661.1&utm_medium=distribute.pc_relevant_t0.none-task-blog-2%7Edefault%7ECTRLIST%7ERat......
  • Vue :一种简单的前端分辨率适配和echarts适配方案
    一、背景对前端不甚了解,对分辨率适配一窍不通,奈何不得不用。文章中的分辨率适配原理我可能说不太明白,但会写出清晰可行的操作步骤。二、核心代码分辨率适配用到了rem、......
  • 【Vue 中 Axios 的封装和 API 接口的管理】
    一.封装各模块作用引入一般我会在项目的src目录中,新建一个request文件夹,然后在里面新建一个http.js和一个api.js文件。http.js文件用来封装我们的axios,api.js用来统一管理......
  • 【Vue2.0与Vue3.0区别总结】
    vue2.0和vue3.0区别结构部分程序主入口文件main.jsvue2.0vue3.0-暴露出createApp方法组件语法部分(vue3.0主要针对api的优化,vue3.0兼容vue2.0写法)vue3.0使用​​组......
  • H5跳转微信小程序-成功案例(VUE)(踩坑无数)
    H5跳转微信小程序-成功案例(VUE)(踩坑无数)TuoMei已于2022-07-2909:52:22修改准备工作根据官方提供的资料需准备以下几点:1、已认证的服务号2、绑定JS接口安全域名......