Tag: DateTime

  • MSSQL datediff in seconds

    The following command on a Microsoft SQL Server calculates the difference in seconds between two datetimes: Example query: Result: If you need the result as a text and also want to add 3 digits after the seconds you can use the following example: Result:

  • C# useful DateTime extensions

    Here are some useful C# DateTime extensions, i hope you enjoy it: You can call it from any class like this little example, don’t forget to add the using in the top of you class. Elapsed The function Elapsed returns the time elapsed between now and the DateTime object. If you need a simple stopwatch,…