// frontend/src/utils/util.js
/**
* 工具函数:UTC转北京时间
* eg: 2021-01-17T13:32:06.381Z
转为:
2021-01-17 21:32:06
*/
/*
* utc转北京时间
*/
function utc2beijing(utc_datetime) {
// 转为正常的时间格式 年-月-日 时:分:秒
let new_datetime = utc_datetime.split("T")[0] + " " + utc_datetime.split("T")[1].split(".")[0];
// 处理成为时间戳
let timestamp = new Date
前端工具:UTC转北京时间
最新推荐文章于 2024-06-24 11:57:56 发布
本文介绍了如何在前端开发中使用JavaScript将UTC时间转换为北京时间,涵盖了日期对象的处理和时区转换的方法,帮助开发者更好地处理时间显示问题。
摘要由CSDN通过智能技术生成