Quantcast
Channel: How to remove time portion of date in C# in DateTime object only? - Stack Overflow
Viewing all articles
Browse latest Browse all 42

Answer by 0x49D1 for How to remove time portion of date in C# in DateTime object only?

$
0
0

You can use format strings to give the output string the format you like.

DateTime dateAndTime = DateTime.Now;Console.WriteLine(dateAndTime.ToString("dd/MM/yyyy")); // Will give you smth like 25/05/2011

Read more about Custom date and time format strings.


Viewing all articles
Browse latest Browse all 42

Trending Articles



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