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 iwhp for How to remove time portion of date in C# in DateTime object only?

$
0
0

Try this, if you use a DateTimeOffset, it will also take care of the timezone

date1 = date1.LocalDateTime.Date;

If you need to add hours, use this:

date1 = date1.LocalDateTime.Date;date1 = date1.AddHours(23).AddMinutes(59).AddSeconds(59);

Viewing all articles
Browse latest Browse all 42

Trending Articles



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