提交 7f46c436 编写于 作者: L ljw

修改时区问题

上级 c89c4f0f
......@@ -24,26 +24,9 @@ exports.main = async (event, context) => {
owner_id: event.userId
}).get()
var time = getSystemTime()
var date = new Date();
var month = date.getMonth() + 1;
if(month < 10)
month = "0"+month;
var day = date.getDate();
if(day < 10)
day = "0"+day;
var hours = date.getHours();
if (hours < 10)
hours = "0" + hours;
var minutes = date.getMinutes();
if (minutes < 10)
minutes = "0" + minutes;
var time = date.getFullYear() + "-" + month + "-" + day +
" " + hours + ":" + minutes;
// return time
if (time>res.data[0]["start_date"] ) {
if (time > res.data[0]["start_date"]) {
return {
code: 200,
message: "成功返回活动详情",
......@@ -85,7 +68,7 @@ exports.main = async (event, context) => {
return {
code: 200,
message: "成功返回活动详情",
qualification: "报名停止",
qualification: "活动人数已满",
data: {
"username": username,
"icon": icon,
......@@ -123,4 +106,27 @@ exports.main = async (event, context) => {
"message": "返回小队活动详情失败",
"data": {}
}
};
\ No newline at end of file
};
function getSystemTime() {
// 实例化日期类
var time = new Date();
// 获取完整的年份(4位)
var year = time.getFullYear();
// 获取月份(0-11,0代表1月)
var month = time.getMonth() + 1;
// 获取日期(1-31)
var date = time.getDate();
// 获取小时
var h = time.getHours() + 8;
h = h < 10 ? '0' + h : h;
// 获取分钟
var m = time.getMinutes();
m = m < 10 ? '0' + m : m;
// 获取秒钟
var s = time.getSeconds();
s = s < 10 ? '0' + s : s;
// 合并返回
return(year + "-" + month + "-" + date + " " + h + ":" + m) ;
}
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册