Hey everyone,

I am trying to figure out which format to send dates into Mysql.
I have been reading the forums and it seems a good method is to convert everything to a unix timestamp and then enter it in mysql as an integer as opposed to the Mysql data type.

I have got the code below and I cannot understand why the two timestamps are more than 86400 seconds in difference. I probably can't count and it is probably something obvious.

<?php
echo "<br><br>";
echo "<br><br>Time Function<br>";
echo time();
echo "<br><br>";

echo "<br>Date Functions<br>";
$today = date('j-m-y');
echo $today;
echo "<br>";

$mydate7 = floor(strtotime($today));
echo $mydate7;
?>

Time Function
1122146657

Date Functions
23-07-05
1688540400

    one reason for the difference is that strtotime needs a certain sorting. Try this:

    $today = date('Y-m-j');
    echo strtotime($today);
    
    

    now you still have a difference which is the time of the day.

    Grius

      Write a Reply...