HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.

How to set the default user timezone in a timestamp

Is there a way to set the timezone in the query result?

Example 'DateInserted' needs to be in a user timezone.

$query = Gdn::sql();
$query->select('u.*,ur.*,r.Name as Role')->from("User u");
$query->join('UserRole ur', 'u.UserID = ur.UserID', 'inner');
$query->join('Role r', 'ur.RoleID = r.RoleID', 'inner');
$query->OrderBy('u.DateInserted', 'desc');



  • Options
    K17K17 Français / French Paris, France ✭✭✭

    Correct me if I'm wrong but timestamp do not bother with timezone, everyone have the same timestamp for all timezones.

    The timestamp is the amount of seconds since the 1st january 1970 at 00:00:00 UTC 0.

    In Vanilla this timestamp is display to the user according to his own timezone (set in the "HourOffest" column of your GDN_User table).

Sign In or Register to comment.