Re: Date comparison Question

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Apr 7, 2008 at 9:42 AM, <admin@xxxxxxxxxxxxxxxxxxx> wrote:

> I am having a date time comparison issue.
> I have statically set the values here. But the data is fed from the
> database, CaldTime is timestamp and since it will not allow me to have 2
> timestamps in the same table I set the CallEnd varchar(12). Storing the data
> they seem to be the same for output. I checked hexadecimal and binary to
> look for obscurities.
>
>
> $sqldata['CaldTime']  = "2008-04-07 11:15:32";
> $sqldata['CallEnd'] = "2008-04-07 11:17:17";
>
> $time1 = strtotime("$sqldata[CaldTime]");
> $time2 = strtotime("$sqldata[CallEnd]");
> $interval = $time2 - $time1;
>
> echo $interval;
>
> +++++++++++++++++++++++++++++++++++++++++++++++++++++++
> Displays like 1.75:0
> I am looking for a more precise time like 1:45 instead.
> Am I looking at this all wrong for time difference?


hmm.
different results for me w/ this code

<?php
$time1 = strtotime('2008-04-07 11:15:32');
$time2 = strtotime('2008-04-07 11:17:17');

echo "time1: $time1" . PHP_EOL;
echo "time2: $time2" . PHP_EOL;

$interval =  $time2 - $time1;
echo $interval . PHP_EOL;
?>

time1: 1207588532
time2: 1207588637
105

-nathan

[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux