TimeZone settings

Hi, all!
Does someone know where in code/database/CRM files I can find user settings of timezone? I need this to change by code or sql query (not from admin menu).

You can change your users timezone in your user preferences(click your username in the top right menu) or globally in Admin -> Locale.

Thanks,

Will.

Thanks for reply!
But I needed a bit another information and I’ve already solved this issue)
Maybe there is more simple way to solve this but here’s my solution (maybe it’ll help someone), see following:
In DB you can find only name of time zone. You can find it in [user_preferences] table in [contents] column encoded in base64. But there is no time offset of this timezone.
To get timezone offset from that column in DB we have to write it at the same time when we click on “Save” button (while creating or editing user).

To do this GOTO: \modules\Users, open file “Save.php” and after (nearly 378 line)
“$GLOBALS = true;
$focus->save();”
you have to insert following code:
///////////////////////////////////////////////////////////////////////////
// adding timeZone offset to [user_preferences][contents]
$userTimeZoneOffset = $focus->getUserDateTimePreferences();
$userTimeZoneOffset = $userTimeZoneOffset;

$indexOfGTM = strpos($userTimeZoneOffset,“GMT”);
$userTimeZoneOffset = substr($userTimeZoneOffset, $indexOfGTM + 3);
$userTimeZoneOffset = rtrim($userTimeZoneOffset, “)”);

$focus->setPreference(‘timezoneOffset’, $userTimeZoneOffset, 0, ‘global’);
$focus->save();
// end of my code
///////////////////////////////////////////////////////////////////////////

P.S. you have to spend a bit time to make sql request for getting this value from encoded string.

hi, thank for ur solution. I did go to \modules\Users, but there is do not have “Save.php” file inside that. Inside the file only have SaveTimezone file.

@shimin Please open a new topic