L
|
larsonsc 1/2/2007 |
This one has me stumped, I am trying to compare the date time held in a date field to now(). if I echo both the values to the screen, I get the date field output as '2007-01-07 00:00:00' but the value of now() shows as 2007-01-02 16-07-45 without any quotes. The if clause reads thus else if ($dfdv>=now()) $dfdv is a date field value even when $dfdv is greater than now(), it does not enter the loop, please tell me what I am doing wrong
|
T
|
thesofa author 1/2/2007 |
Just the date part please |
L
|
larsonsc 1/2/2007 |
OK, here is how I achieved the date comparison: else if ((date("z", strtotime($dfdv))) >= date("z")) {
|
T
|
thesofa author 1/2/2007 |
Ha, that was quick! else if (substr($dfdv,1,10)>=now())
|
L
|
larsonsc 1/2/2007 |
Ha, that was quick! I have found a different way around this, that seems to work. I have used substr, like this this takes the characters from 1 for 10, count starts at 0 BTW. so it misses the ' at the start of the data. Thanks for the help anyhow. Happy new Year too.
|
D
|
Dale 1/2/2007 |
Happy New Year, |
T
|
thesofa author 1/2/2007 |
that wasn't the problem, the problem is the apostrophe around the value from the date field, whereas now() does not have them. |