当前位置:网站首页>Timestamp transform to standard time format

Timestamp transform to standard time format

2022-06-10 02:43:00 Roam-G

Catalog

What is the timestamp ?

Time stamp -> Standard time format

1. Back end transformation

2. Front end transformation


What is the timestamp ?

Popular understanding is to prove the verifiable seal of time , For example, I want to take pictures , How to prove time , Beating the clock is obviously impossible to prove , We can prove it by shooting news newspapers and lottery numbers . Let's introduce the timestamp in detail ?

Time stamp means Greenwich mean time 1970 year 01 month 01 Japan 00 when 00 branch 00 second ( Beijing time. 1970 year 01 month 01 Japan 08 when 00 branch 00 second ) The total number of seconds since .

1. Self built timestamp : This kind of timestamp is received through the time receiving device ( Such as GPS,CDMA, Beidou satellite ) To get the time stamp on the server , And issue the timestamp certificate through the timestamp server . This time stamp can be used to identify the internal responsibility of the enterprise , It has no legal effect at the time of court Certification . Because it may be tampered when receiving time through the time receiving device , Therefore, it cannot be used as a legal basis .

2. A legally valid timestamp : It is a third-party trusted timestamp authentication service in China, which is built by the national time service center of Chinese Academy of Sciences and Beijing United trust Technology Service Co., Ltd . The national time service center is responsible for time service and punctuality monitoring . Because of its punctual monitoring function, the time in the timestamp certificate is guaranteed to be accurate and not tampered with . The platform for obtaining time stamp is “ Mass copyright protection platform ”[1] , It can be synchronized with the national time service center of Chinese Academy of Sciences .

Time stamp -> Standard time format

 

1. Back end transformation

for(int i=0;i<list.size();i++) {

SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");

//                 1- createTime   Creation time  2-  timeLastModified       Last modified  3-  cutPaymentTime  VIP Due date 

String dateString1 = simpleDateFormat.format(list.get(i).getCreateTime());

list.get(i).setCreateTime2(dateString1);

// 2.

String dateString2 = simpleDateFormat.format(list.get(i).getTimeLastModified());

list.get(i).setTimeLastModified2(dateString2);

// 3.

String dateString3 = simpleDateFormat.format(list.get(i).getCutPaymentTime());

list.get(i).setCutPaymentTime2(dateString3);

}

2. Front end transformation

<li class="pct12 fsize14 bold" style="text-align:right;"> Creation time :</li>

<li class="pct38">

{
   {orderObj.createTime>0?Commutil.date_subStr($globals.getFormatDate(orderObj.createTime),16):''}}

</li>

<li class="pct12 fsize14 bold" style="text-align:right;"> Last modified :</li>

<li class="pct38">

{
   {orderObj.timeLastModified>0?Commutil.date_subStr($globals.getFormatDate(orderObj.timeLastModified),16):''}}

</li>


	@RequestMapping(value = "/findAllCompany", method = RequestMethod.POST)
	@ApiOperation(value = " Query all enterprise information ")
	@ApiImplicitParams({@ApiImplicitParam(name = "find", value = " Incoming parameter ", required = true, paramType = "body", dataType = "TbCompany")})
	public ResultCode<TbCompany> findAllCompany(@RequestBody TbCompany find) {
		ResultCode<TbCompany> rc = new ResultCode<TbCompany>();
		try {
		// Get login information 
		CacheEmployee ce = (CacheEmployee) SecurityUtils.getSubject().getPrincipals().getPrimaryPrincipal();
		// If the employee is not a service provider 
		if(ce == null) {
			rc.setCode(CommonEnum.NO_PERMISSION.getCode());
			rc.setMsg(CommonEnum.NO_PERMISSION.getMsg());
			return rc;
		}
		if(99!=ce.getUserType()) { // Caravan staff 
			rc.setCode(CommonEnum.NO_PERMISSION.getCode());
			rc.setMsg(CommonEnum.NO_PERMISSION.getMsg());
			return rc;
		}
		Map<String, Object> params = new HashMap<String, Object>();
		if(Sys.isCheckNull(find.getId()) > 0) {
			params.put("ids", Sys.isCheckNull(find.getId()));
		}
		if(Sys.isCheckNull(find.getName()) !="") {
			params.put("namesLike", Sys.isCheckNull(find.getName()));
		}
		if(Sys.isCheckNull(find.getStatus()) ==1) {
			params.put("statuss", "1");//  The query is normal 
		}
		if(Sys.isCheckNull(find.getStatus()) ==2) {
			params.put("statuss", "2");//  Query deactivation 
		}
		params.put("findallparams", "all");//  Query all 
		if(Sys.isCheckNull(find.getPage())<=0) {
			find.setPage(1);
		}
		if(Sys.isCheckNull(find.getPageSize())<=0) {
			find.setPageSize(50);
		}else if(2 == find.getFlagExcel()) {
			find.setPageSize(50000);
		}
//		 Add export Excel file    2  export ,1  Search for 
		params.put("startNum", Sys.getStartNum(find.getPage(), find.getPageSize()));
		params.put("pageSize", find.getPageSize());

		int count = companyService.findCompanyCount(params);
		if(count > 0) {
			List<TbCompany> list = companyService.findCompany(params);
			if(list != null && list.size() > 0) {
				rc.setTotalNum(count);
				rc.setCode(CommonEnum.SUCCESS.getCode());
				rc.setMsg(CommonEnum.SUCCESS.getMsg());
//				 Judge here ,  Modify the time format of the incoming front end .  If flagExcel ==2.  hold   Time stamp   Change to    Standard time .
				if(2==find.getFlagExcel()) {
//					 Need to export , Change time format     Commutil.date_subStr($globals.getFormatDate(item.timeLastModified),16):''
					for(int i=0;i<list.size();i++) {
						SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
//		                1- createTime   Creation time  2-  timeLastModified       Last modified  3-  cutPaymentTime  VIP Due date 
						String dateString1 = simpleDateFormat.format(list.get(i).getCreateTime());
						list.get(i).setCreateTime2(dateString1);
//						2.
						String dateString2 = simpleDateFormat.format(list.get(i).getTimeLastModified());
						list.get(i).setTimeLastModified2(dateString2);
//						3.
						String dateString3 = simpleDateFormat.format(list.get(i).getCutPaymentTime());
						list.get(i).setCutPaymentTime2(dateString3);
					}

				}else {
//					 No need to export , Don't change .
//					rc.setDatas(list);
				}
				rc.setDatas(list);
				Page page = new Page(find.getPage(), find.getPageSize(), count);
				rc.setPop(page);
			}else {
				rc.setCode(CommonEnum.NO_DATA.getCode());
				rc.setMsg(CommonEnum.NO_DATA.getMsg());
			}
		}else {
			rc.setCode(CommonEnum.NO_DATA.getCode());
			rc.setMsg(CommonEnum.NO_DATA.getMsg());
		}
	} catch (SQLException e) {
		rc.setCode(CommonEnum.SQL_EXCEPTION.getCode());
		rc.setMsg("SQLException:" + e.getMessage());
	} catch (Exception e) {
		rc.setCode(CommonEnum.OTHER_EXCEPTION.getCode());
		rc.setMsg("Exception:" + e.getMessage());
	}

		return rc;
	}
原网站

版权声明
本文为[Roam-G]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/161/202206100237001449.html