Nanoconfined liquid dynamics in aqueous and nonaqueous systems investigated with nonlinear infrared spectroscopies