Subgroups Analysis when Treatment and Moderators are Time-varying