-
[C#] datetime 차이값 구하기C#/WPF_예제소스 2022. 2. 15. 09:57
출처: https://hongjinhyeon.tistory.com/7201.DateTime dtPreTime = new DateTime(2015,03,19,12,0,0); 02.DateTime dtNowTime; 03. 04.DateTime.TryParse("2015-03-20 12:30:0", out dtNowTime); 05. 06.TimeSpan timeDiff = dtNowTime - dtPreTime; 07. 08.int diffDays = timeDiff.Days; //1 09.int diffHoures = timeDiff.Hours; //0 10.int diffMiniute = timeDiff.Minutes; //30 11.int diffSecond = timeDiff.Seconds; //0 12. 13.double diffTotalHours = timeDiff.TotalHours; //24.5 14.double diffTotalMiniute = timeDiff.TotalMinutes; //1470.0 출처: https://hongjinhyeon.tistory.com/72 [생각대로 살지 않으면 사는대로 생각한다.]
[C#] 날짜 비교 (Datetime 시간차이 구하기)
.NET 에서는 두시간의 차이를 구하는데 사용하는 Timespan이라는 타입을 제공합니다. 사용법은 아래와 같습니다. DateTime dtPreTime = new DateTime(2015,03,19,12,0,0); DateTime dtNowTime; DateTime.TryParse(..
hongjinhyeon.tistory.com
728x90'C# > WPF_예제소스' 카테고리의 다른 글
[C#]Serial 버퍼 Data 이어 붙이기 (0) 2022.03.28 [C#]Polygon (0) 2022.02.28 [C#]Viewport2DVisual3D (0) 2022.02.28 [C#] Thread vs Threadstart (0) 2022.02.18 [C#] FPS count (0) 2022.02.15 댓글