Advertisement
Xyberviri

24Hour=>12Hour Format

Apr 8th, 2018
244
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.29 KB | None | 0 0
  1. //when you can't use time conversion or are reciving non standard time, such as in a video game clock using a accelerated tick rate.
  2. int _Hour = DateTime.UtcNow.Hour
  3. string _12Hour = _Hour > 11 ? ( _Hour == 12 ? 12 : _Hour - 12).ToString() + " PM" : (_Hour==0?12:_Hour).ToString() + " AM";
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement