我使用php,sql和ajax进行了聊天。所有消息都以日期时间格式存储在DB中,例如0000-00-00 00:00:00。问题是:每天从午夜(00:00:00)到00:59:59,消息都存储在DB中,但无法在聊天中看到。 在一天的其余时间内,它可以完美运行。我认为这取决于UTC时区。我的时区是UTC +1(所以一天不是从0到23,而是从1到0)。
实际上我使用此PHP代码:
def mpi_fork(n,bind_to_core=False):
"""
Re-launches the current script with workers linked by MPI.
Args:
n (int): Number of process to split into.
bind_to_core (bool): Bind each MPI process to a core.
"""
if n<=1:
return
if os.getenv("IN_MPI") is None:
env = os.environ.copy()
env.update(
MKL_NUM_THREADS="1",OMP_NUM_THREADS="1",IN_MPI="1"
)
args = ["mpirun","-np",str(n)]
if bind_to_core:
args += ["-bind-to","core"]
args += [sys.executable] + sys.argv
subprocess.check_call(args,env=env)
sys.exit()
if __name__ == '__main__':
num_cpu = 3
mpi_fork(num_cpu)
dic = Dict()
for _ in range(3):
exp = EnvSim.get()
dic.update(exp)
print(dic.d)
我存储此日期时间的列:
$now = new DateTime(null,new DateTimeZone('Europe/Rome'));
$now = $now->format('Y-m-d H:i:s');
日期始终正确存储。有人可以帮助我吗?
编辑:调用存储的数据,我使用这个:
'time' datetime NOT NULL DEFAULT '0000-00-00 00:00:00'