Click here to Skip to main content
15,891,943 members
Please Sign up or sign in to vote.
3.00/5 (1 vote)
See more:
how to convert utc time to 24 hours format in HH:MM:SS?
Posted
Comments
DamithSL 16-Jan-15 11:29am    
how you hold utc time in your program?

Custom Date and Time Format Strings[^]:
C#
string formattedDate = DateTime.UtcNow.ToString("yyyy-MM-dd HH:mm:ss");
// Example output: 2015-01-16 16:26:32
 
Share this answer
 
Comments
Sergey Alexandrovich Kryukov 16-Jan-15 12:14pm    
5ed, but I also added background information with links in Solution 2.
—SA
In addition to Solution 1:

Please see all related methods:
http://msdn.microsoft.com/en-us/library/system.datetime.tostring%28v=vs.110%29.aspx[^].

What you need is formatting. is not "conversion". Note that parameters allows you to format depending on culture (System.Globalization.CultureInfo implements IFormatProvider; http://msdn.microsoft.com/en-us/library/system.globalization.cultureinfo%28v=vs.110%29.aspx[^]) or format string:
http://msdn.microsoft.com/en-us/library/az4se3k1(v=vs.110).aspx[^],
http://msdn.microsoft.com/en-us/library/8kb3ddd4(v=vs.110).aspx[^],
see also http://msdn.microsoft.com/en-us/library/zdtaw1bw%28v=vs.110%29.aspx[^].

—SA
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900