On Tue, Apr 15, 2008 at 5:24 PM, John A DAVIS <[EMAIL PROTECTED]> wrote:
>
>
> Thanks! My guess is the production server has this set correctly and I will
> follow your advice.
> However, how would one do away with this error? What would I do to guarantee
> an string being returned instead of a date? What can I wrap the date()
> function in?
>
>    $month=substr($thisdate,0,2);
>    $day =substr($thisdate,3,2);
>    $year = substr($thisdate,6,4);
>
>    $d =date("M d (D)",Mktime(0,0,0,$month,$day,$year));
>
>
> Again, thank you!
> John A. Davis

I don't think you need to wrap date() in anything, as it should be
returning a string. Without seeing the actual input that caused the
warning, I think it's probably more an issue with either $month, $day,
or $year not being quite right (but close enough that PHP can still
obtain the correct result). Is it possible (since you're getting the
date from a database query) that the value is coming back as a
datetime string that includes a time portion? Your function should
work OK if you are getting something that looks like '10-02-2008
10:15:27' but will get the error you reported if it gets the same
value as '10022008 10:15:27'. Try doing a var_dump on each value to
make sure it's what you expect it to be.

Andrew

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to