import datetime import pytz
now = datetime.datetime.now()
utc_now = datetime.datetime.utcnow().replace(tzinfo=pytz.utc)
local_now = utc_now.astimezone(pytz.timezone('Asia/Shanghai'))
import datetime import pytz
request_timestamp = datetime.datetime.strptime(request.POST['timestamp'], '%Y-%m-%d %H:%M:%S')
local_timestamp = pytz.timezone('Asia/Shanghai').localize(request_timestamp, is_dst=None)
response = my_function(local_timestamp)
// 获取当前时间 var now = new Date();
// 将当前时间转换为 UTC 时间戳 var utc_timestamp = Date.UTC(now.getUTCFullYear(), now.getUTCMonth(), now.getUTCDate(), now.getUTCHours(), now.getUTCMinutes(), now.getUTCSeconds());
// 将 UTC 时间戳作为请求参数发送 $.ajax({ url: '/my-api', data: { 'timestamp': utc_timestamp }, success: function(response) { // 浏览器中将 UTC 时间戳转换为本地时间 var local_timestamp = new Date(response.timestamp); // 在页面上显示本地时间 $('#my-t