hzruo commited on
Commit
b18468d
·
verified ·
1 Parent(s): 4a25bfa

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -1
app.py CHANGED
@@ -309,6 +309,16 @@ async def root():
309
  else:
310
  expiry_readable = "已过期"
311
 
 
 
 
 
 
 
 
 
 
 
312
  html_content = f"""
313
  <!DOCTYPE html>
314
  <html>
@@ -414,7 +424,7 @@ async def root():
414
  </div>
415
 
416
  <div class="footer">
417
- <p>当前时间: {time.strftime('%Y-%m-%d %H:%M:%S', time.localtime())}</p>
418
  </div>
419
  </body>
420
  </html>
 
309
  else:
310
  expiry_readable = "已过期"
311
 
312
+ # 使用东八区时间(中国标准时间)
313
+ import datetime
314
+ from datetime import timezone, timedelta
315
+
316
+ # 创建东八区时区对象
317
+ china_tz = timezone(timedelta(hours=8))
318
+ # 获取当前UTC时间并转换为东八区时间
319
+ current_time_china = datetime.datetime.now(china_tz)
320
+ formatted_time = current_time_china.strftime('%Y-%m-%d %H:%M:%S')
321
+
322
  html_content = f"""
323
  <!DOCTYPE html>
324
  <html>
 
424
  </div>
425
 
426
  <div class="footer">
427
+ <p>当前时间: {formatted_time} (中国标准时间)</p>
428
  </div>
429
  </body>
430
  </html>