public static function getClientTimezone($user = null) {

		if (isset(self::$timezone)) {
			return self::$timezone;
		}

		$preferred = array();

		$preferred[] = get_input('timezone');

		if ($user == null) {
			$user = elgg_get_logged_in_user_entity();
		}
		
		if ($user) {
			$preferred[] = $user->timezone;
		}

		if (defined('ELGG_SITE_TIMEZONE')) {
			$preferred[] = ELGG_SITE_TIMEZONE;
		}

		$preferred[] = date('e');

		foreach ($preferred as $id) {
			if (self::isValidTimezone($id)) {
				self::$timezone = $id;
				return $id;
			}
		}

		return Util::UTC;
	}