convert time to WordPress user’s local time

The correct function to use for what you describe would be date_i18n() WordPress function.

It will produce output that is correct for timezone configured in WordPress and also localized if necessary.

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