RE: [PHP] date problem
| From: | Marc Fromm | Date: | Thu, 03 Jan 2013 22:12:45 +0000 |
| Subject: | RE: [PHP] date problem | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-320022@lists.php.net to get a copy of this message | ||
Thanks for the reply.
Every example on comparing dates in PHP that I found uses the "strtotime" function which I
am using. What other type can I use?
When is this example below supposed to work?
// your first date coming from a mysql database (date fields)
$dateA = '2008-03-01 13:34';
// your second date coming from a mysql database (date fields)
$dateB = '2007-04-14 15:23';
if(strtotime<http://www.php.net/strtotime>($dateA)
> strtotime<http://www.php.net/strtotime>($dateB)){
// bla bla
}
Thanks
From: Serge Fonville [mailto:serge.fonville@gmail.com]
Sent: Thursday, January 03, 2013 2:05 PM
To: Marc Fromm
Cc: php-general@lists.php.net
Subject: Re: [PHP] date problem
Hi.
date returns a string
You should compare a different type for bigger/smaller than
HTH
Kind regards/met vriendelijke groet,
Serge Fonville
http://www.sergefonville.nl
Convince Microsoft!
They need to add TRUNCATE PARTITION in SQL Server
https://connect.microsoft.com/SQLServer/feedback/details/417926/truncate-partition-of-partitioned-table
2013/1/3 Marc Fromm <Marc.Fromm@wwu.edu<mailto:Marc.Fromm@wwu.edu>>
I am comparing to dates.
define('WSOFFBEGIN','09/16/2012');
$jes = 01/03/2012;
if ( date("m/d/Y", strtotime($jes)) < date("m/d/Y", strtotime(WSOFFBEGIN)) )
{
$error = " MUST begin after " . WSOFFBEGIN . "\n";
}
I cannot figure out why the $error is being assigned inside the if statement, since the statement
should be false. 01/03/2012 is not less than 09/16/2012.
Marc