Quantcast
Channel: C#: How would I get the current time into a string? - Stack Overflow
Viewing all articles
Browse latest Browse all 7

Answer by Kartiikeya for C#: How would I get the current time into a string?

$
0
0

Method to get system Date and time in a single string

public static string GetTimeDate()
{
    string DateTime = System.DateTime.Now.ToString("dd-MM-yyyy HH:mm:ss");   
    return DateTime;
} 

sample OUTPUT :-16-03-2015 07:45:15

Viewing all articles
Browse latest Browse all 7

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>