Increasing numbers of post hoc analyses have applied restricted mean survival time (RMST) analysis on the aggregated-level data from clinical trials to report treatment effects, but studies that use individual-level claims data are needed to determine the feasibility of RMST analysis for quantifying treatment effects among patients with type 2 diabetes in routine clinical settings. To apply RMST analysis for assessing sodium-glucose cotransporter-2 inhibitor (SGLT2i)-associated cardiovascular (CV) events and estimating heterogenous treatment effects (HTEs) on CV and kidney outcomes in routine clinical settings. This comparative effectiveness study of Taiwan's National Health Insurance Research Database examined 21 144 propensity score (PS)-matched pairs of patients with type 2 diabetes with SGLT2i and dipeptidyl peptidase-4 inhibitor (DPP4i) treatment for assessing CV outcomes, and 19 951 PS-matched pairs of patients with type 2 diabetes with SGLT2i and DPP4i treatment for assessing kidney outcomes. Patients were followed until December 31, 2018. Statistical analysis was performed from August 2021 to April 2022. Newly stable SGLT2i or DPP4i use in 2017. Study outcomes were CV events including hospitalization for heart failure (HHF), 3-point major adverse CV events (3P-MACE: nonfatal myocardial infarction [MI], nonfatal stroke, and CV death), 4-point MACE (4P-MACE: HHF and 3P-MACE), and all-cause death, and chronic kidney disease (CKD). RMST and Cox modeling analyses were applied to estimate treatment effects on study outcomes. After PS matching, the baseline patient characteristics were comparable between 21 144 patients with stable SGLT2i use (eg, mean [SD] age: 58.3 [10.7] years; 11 990 [56.7%] male) and 21 144 patients with stable DPP4i use (eg, mean [SD] age: 58.1 [11.6] years; 12 163 [57.5%] male) for assessing CV outcomes, and those were also comparable between 19 951 patients with stable SGLT2i use (eg, mean [SD] age: 58.1 [10.7] years; 11 231 [56.2%] male) and 19 951 patients with stable DPP4i use (eg, mean [SD] age: 57.9 [11.5] years; 11 340 [56.8%] male) for assessing kidney outcome. The 2-year difference in RMST between patients with SGLT2i use and patients with DPP4i use was 4.99 (95% CI, 3.56-6.42) days for HHF, 4.12 (95% CI, 2.72-5.52) days for 3P-MACE, 7.72 (95% CI, 5.83-9.61) days for 4P-MACE, 1.26 (95% CI, 0.47-2.04) days for MI, 2.70 (95% CI, 1.57-3.82) days for stroke, 0.69 (95% CI, 0.28-1.11) days for CV death, 6.05 (95% CI, 4.89-7.20) days for all-cause death, and 14.75 (95% CI, 12.99-16.52) days for CKD. Directions of hazard ratios from Cox modeling analyses were consistent with RMST estimates. No association was found between study treatment and the negative control outcome (dental visits for tooth care). Consistent results across sensitivity analyses using high-dimensional PS-matched and PS-weighting approaches supported the validity of primary analysis results. Largest difference in RMST of SGLT2i vs DPP4i use for HHF and CKD was found among patients with established heart failure (30.80 [95% CI, 5.08-56.51] days) and retinopathy (40.43 [95% CI, 31.74-49.13] days), respectively. In this comparative effectiveness study, RMST analysis was feasible for translating treatment effects into more clinical intuitive estimates and valuable for quantifying HTEs among diverse patients in routine clinical settings.