I'm tracking when users register through my wordpress site. In order to store the user information, I have the following code:
$user = wp_get_current_user();
if (is_user_logged_in() && $user) {
$identify = array(
'user_id' => $user->user_email,
'traits' => array(
'username' => $user->user_login,
'email' => $user->user_email,
'name' => $user->display_name,
'firstName' => $user->user_firstname,
'lastName' => $user->user_lastname,
'url' => $user->user_url,
'created_at' => $user->user_registered
)
);
}
However $user->user_registered
is somehow reporting a unix timestamp that's 7 hours ahead. I logged into my server and it showed the current time accurately. I went to my general settings and my time zone is 7 hours behind. However a unixtimestamp should be consistent no matter the time zone, no? So my question is this: why is user_registered showing the incorrect unix time and how can I fix it?