- Home /
Adjusting DateTime values
I am using DateTime.UtcNow to get local time on a clock. It is working fine. Although I want to have other clocks in the room that are not the same time. By that I only mean 5 minutes ahead and 5 minutes behind.
I can't quite get my head around the correct math for my code. And I have a feeling it is going to be a very simple solution. Of course when real time is at 55 minutes and I make it 60 the next minute will have to change the hour right. Eventually that gets messy. Same issue with being 5 minutes behind. Any suggestions? Thanks in advance.
Answer by diggerjohn · Dec 03, 2013 at 06:35 PM
Got it. var minutes = System.DateTime.Now.AddMinutes(5).Minute; And for making the clock 5 minutes behind var minutes = System.DateTime.Now.AddMinutes(-5).Minute;
Your answer
Follow this Question
Related Questions
clock second smooth movement 1 Answer
How do you display the Time? (as in you're PCs clock) 1 Answer
Smaller Time Interval? 3 Answers
Visual timer? Like CUT THE ROPE 2 Answers
Programming Accurate Clock Hands 1 Answer