Pergunta

The Unix Time Stamp generated by my MKTIME is not generating correctly

(European format)

Date Submitted: 15/02/2014 19:00

Unix Code: 1392508800

This returned date is: 16/02/2014 00:00:00 Code it should of returned is: 1392490800

Code Used After form is submitted values are captured and assigned...

if ($_POST['Callbacl']){

    $CID=$_POST['ID'];
    $Notes = $_POST['callbacknotes'];

    $Time_H = $_POST['Time_Hour'];
    $Time_M = $_POST['Time_Minute'];
    $Date_Day = $_POST['Date_Day'];
    $Date_Month = $_POST['Date_Month'];
    $Date_Year = $_POST['Date_Year'];

    $Appt = mktime($Time_H, $Time_M,00, $Date_Month, $Date_Day, $Date_Year);
    echo $Appt . "<br>";
    die;
}

Post values

     Array ( 
    [ID] => 1 
    [Time_Hour] => 19 
    [Time_Minute] => 00 
    [Date_Month] => 02 
    [Date_Day] => 15 
    [Date_Year] => 2014 
    [callbacknotes] => 
    [Callback] => Call Back 
    )
Foi útil?

Solução

I suppose to your time zone in php.ini is not your preferred one. Try to set a proper time zone in php.ini or to add the following code at the beginning of your block.

date_default_timezone_set('your time zone');

There is the list of supported time zones in PHP:

http://www.php.net/manual/en/timezones.php

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top