Sir I have these codes


$queryx = "SELECT max( date
from (
select max(date)as date  from crprp  
union all
select max(date)as date from pouring  
union all
select max(date)as date from product  
) as data";

$resultx = sqlsrv_query($con,$queryx)or die ("Error". sqlsrv_errors($con)) ;  
while ($rowx = sqlsrv_fetch_array ($resultx)){

echo date('l F d, Y', strtotime($stockdate));

The codes displays this result

I tested the codes at some place like this

The result is ok here but what is worng with my above codes?



from the documentation the strtotime() function you can read:

Parse about any English textual datetime description into a Unix timestamp

And it expects:

int strtotime ( string $time [, int $now = time() ] )

The $stockdate is a DateTime object, not a string. So try by submitting the string:

date('l F d, Y', strtotime($stockdate->date));

Or follow the DateTime library:

print $stockdate->format('l F d, Y');


Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.