How C # Calculates the incoming time distance for instance sharing of today's difference
<summary>///Calculate the time-to-pass from today///</summary>//<param name= "DT" ></param> <param name= "yy" ></param>//<param name= "MM" ></param>//<param name= "D D "></param> public void Getcriminalyx (DateTime dt, out int yy, out int mm, out int dd) {Da Tetime now = DateTime.Now; yy = mm = DD = 0; if (dt. Year > 9000 | | Dt. Year = = 1900) {return; } if (dt <= now) {return; } StringBuilder str = new StringBuilder (); int dt_y = dt. year; int dt_m = dt. Month; int dt_d = dt. Day; int now_y = DateTime.Now.Year; int now_m = DateTime.Now.Month; int now_d = DateTime.Now.Day; yy = dt_y-now_y; MM = Dt_m-now_m; DD = 0;int Dt_m_sy = 0; if (Dt_d < now_d) { MM-= 1; Dt_m_sy = dt_m-1; if (Dt_m_sy = = 0) {Dt_m_sy = 12; } if (Dt_m_sy = = 2) {dt_m_sy = dt_y% 4 = = 0? 29:28; } else {Dt_m_sy = Dt_m_sy = = 2 | | dt_m_sy = = 4 | | dt_m_sy = = 6 | | dt_m_sy = = 9 | | Dt_m_sy = = 11? 30:31; } dt_d + = Dt_m_sy; } DD = Dt_d-now_d; if (mm < 0) {yy-= 1; MM + = 12; } }