How do I convert current system time in to UTC seconds
How c开发者_高级运维an I convert time of day to UTC seconds in C#
Not sure if I understand correctly, you want to get the second
of UTC? Try: int nSeconds = DateTime.SpecifyKind(DateTime.Now, DateTimeKind.Local).ToUniversalTime().Second;
to get the seconds.
See Converting Times Between Time Zones;
Your question isn't entirely clear, but you might be after:
TimeSpan timeOfUtcDay = DateTime.UtcNow.TimeOfDay;
double seconds = timeOfUtcDay.TotalSeconds;
For example, it's currently about 7:15 BST (Europe/London), which is 6:15 UTC. The above code gives 22573.6674426, which is just a bit more than (6 * 60 + 15) * 60.
精彩评论