[Solved] Warning: date() expects parameter 2 to be long, object given in [closed]


The variable you supplied ($songs->PLAYEDAT) is probably a string or at best a DateTime object.

If it’s a DateTime object:

$songs->PLAYEDAT->format('Y-m-d H:i:s')

If it’s a string representation of a date:

date('Y-m-d H:i:s', strtotime($songs->PLAYEDAT))

UPDATE: Answer specific to this question copied back from comment below

date('Y-m-d H:i:s', intval($songs->PLAYEDAT[0]))

8

solved Warning: date() expects parameter 2 to be long, object given in [closed]