欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  IT编程

jsp用代码将CST格式的时间转换为GTM格式的时间

程序员文章站 2022-08-04 15:57:58
用代码将cst格式的时间转换为gtm格式的时间 $scope.datetogmt=function(strdate){ var datestr=strdate.split(...

用代码将cst格式的时间转换为gtm格式的时间

 $scope.datetogmt=function(strdate){
         var datestr=strdate.split(" ");
         var strgmt = datestr[0]+" "+datestr[1]+" "+datestr[2]+" "+datestr[5]+" "+datestr[3]+" gmt+0800";
         var date = new date(date.parse(strgmt));
         return strgmt;
     }
     $scope.comparetime=function () {
         var gmtbegintime=$scope.datetogmt('${vote.begintime}');

         var timestampbegin = date.parse(gmtbegintime);//转为时间戳
         var timstampnow=date.parse(new date());//转为时间戳
         timestampbegin = timestampbegin / 1000;
         timstampnow = timstampnow / 1000;
       

     }