Click here to Skip to main content
15,880,725 members
Articles / Programming Languages / SQL

Removing the minutes and seconds from a DATETIME

Rate me:
Please Sign up or sign in to vote.
4.57/5 (6 votes)
24 Mar 2020CPOL 14.9K   3  
A basic user defined function to remove minute and second from a DATETIME
This came up in a question about grouping timestamps into two-hour "windows" and I figured it might be useful to others. So: a basic user defined function to remove the minute and second from a DATETIME. It's then pretty trivial to group them into "windows" of any length you need.

Views

Daily Counts

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
CEO
Wales Wales
Born at an early age, he grew older. At the same time, his hair grew longer, and was tied up behind his head.
Has problems spelling the word "the".
Invented the portable cat-flap.
Currently, has not died yet. Or has he?

Comments and Discussions