Try this -
DateTime dt = ValidationHelper.GetDateTime(eventArgument, DateTimeHelper.ZERO_TIME);
UserRoleInfo uri = UserRoleInfoProvider.GetUserRoleInfo(mUserId, id);
if (uri != null)
{
uri.ValidTo = dt;
UserRoleInfoProvider.SetUserRoleInfo(uri);
}
You can find detailed code for Assign role to user with validTo from the following page on Source code.
CMS/CMSModules/Membership/Pages/Users/User_Edit_Roles.aspx