Seconds from now to seven o'clock.
I need to know current time UTC and how many seconds there is to 7:00 pm (or 19:00) So I need this because I have to know how many seconds away to send notification. Let's say that current time UTC is 6:30 pm and player open my app and that register that send notification after 1800 seconds.
Answer by djlw78 · Jul 31, 2017 at 04:39 PM
Well, @Tap1 you would get DateTime.(Now, Etc) and increase it. Example 7h (*times) 60m = 420 (*times) 60 (capturing the seconds) 25, 200 Alternatively go to google and type in hours to seconds and a thing will pop up that will help you convert it.
EDIT: TRY THIS CODE. @Tap1
using System;
namespace ConsoleApp1 { class Program { static void Main(string[] args) { TimeSpan TillSeven; DateTime date = new DateTime(2017, 7, 31, 7, 00, 0); TillSeven = DateTime.UtcNow - date; Console.WriteLine(TillSeven.Hours 60 60); //4 hour 60 = 240 Minutes 60 = 14,400 Seconds. Console.ReadKey(); } } }
Yes but let say that I use DateTime.UtcNow command. That will print current time like 4:00 pm and day. How I can calculate how many $$anonymous$$utes away that is from 7:00 pm.
Subtraction. UtcNow - DateTime.<7:00P$$anonymous$$> So you would use DateTime date = new DateTime(2014, 7, 2, 7, 47, 0) (example)
then DateTime.UtcNow - date
Your answer
Follow this Question
Related Questions
Animation window time bar shows 1 minute increments - HELP 0 Answers
DateTime.Today for Different Time Zone 1 Answer
Wont instantiate game object 1 Answer
Alarm Clock Using System Time 0 Answers
Getting the time from a server 2 Answers