php时间不正确它的帮助后一小时。 [英] php time not correct its one hour behind help.

查看:57
本文介绍了php时间不正确它的帮助后一小时。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嘿,我住在南非,每次我把时间插入我的数据库,它给了我1小时的当前时间,我认为这是因为夏令时你可以帮我修复下面这个来源。



 <?php  

include( connect.php);
include( Includes / view.php);

session_start();

if(!isset($ _ SESSION [' id']))
{
header(' 位置:../ index.php') ;
}

$ name = $ _SESSION [' 名称];
$ queue = $ _POST [' queue ];
// $ TarosID = $ _POST ['TarosID'];
< span class =code-comment> //
$ Status = $ _POST ['Status'];
// $ Reason = $ _POST ['Reason'];

$ date = date( Y / m / d);
$ time = date( H: I:的);

$ query = INSERT INTO sms_traffic_db.table_data(名称,日期,时间,队列)VALUES('。$ name。 ','。$ date。 ','。$ time。 ','。$ queue。 ');
$ result = mysql_query($ query) mysql_error();
if($ result)
{
header(' 位置:../ main.php');
echo 数据已成功插入;
}
else
{
header(' 位置:../ add_entry.php');
echo 错误 .mysql_error();
}
echo ' < ; p>'。$ query。' < / p>';

mysql_close();

?>

解决方案

_SESSION [' id']))
{
header(' 位置:../ index.php');
}


name =


_SESSION [' name'];


hey guys i live in south africa and every time i insert the time to my database it gives me 1hour behind current time i think it is because of daylight savings can you help me fix this source below.

<?php

include("connect.php");
include("Includes/view.php");

session_start();

if( !isset($_SESSION['id']))
{
    header('Location: ../index.php');
}

$name = $_SESSION['name'];
$queue = $_POST['queue'];
//$TarosID = $_POST['TarosID'];
//$Status = $_POST['Status'];
//$Reason = $_POST['Reason'];

$date = date("Y/m/d");
$time = date("H:i:s");

$query = "INSERT INTO sms_traffic_db.table_data (name, date, time, queue) VALUES ('".$name."', '".$date."','". $time."', '".$queue."')";
$result = mysql_query($query) or mysql_error();
if($result)
{
    header('Location: ../main.php');
    echo "Data Inserted successfully";
}
else
{
    header('Location: ../add_entry.php');
    echo "Error" .mysql_error();
}
echo '<p>'.$query.'</p>';

mysql_close();

?>

解决方案

_SESSION['id'])) { header('Location: ../index.php'); }


name =


_SESSION['name'];


这篇关于php时间不正确它的帮助后一小时。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆