How to truncate milliseconds off of a .NET DateTime
        Posted  
        
            by Jeff Putz
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by Jeff Putz
        
        
        
        Published on 2009-06-17T01:43:19Z
        Indexed on 
            2010/04/21
            9:43 UTC
        
        
        Read the original article
        Hit count: 1038
        
I'm trying to compare a time stamp from an incoming request to a database stored value. SQL Server of course keeps some precision of milliseconds on the time, and when read into a .NET DateTime, it includes those milliseconds. The incoming request to the system, however, does not offer that precision, so I need to simply drop the milliseconds.
I feel like I'm missing something obvious, but I haven't found an elegant way to do it (C#).
© Stack Overflow or respective owner