Using PHP to read WordPress Posts

I think that you are looking for the function get_post_status
Example:

if (get_post_status($postid)=='publish')
echo date_i18n( $date_format, strtotime( $expiration_date ) ); 

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)