-- An SQL User defined function to round off date time-- to nearest half an hour point CREATE FUNCTION RoundOffHours( @myTime datetime) RETURNS datetime ASBEGIN DECLARE @RoundedTime datetime SELECT @RoundedTime = dateadd( minute, CASE WHEN (datepart(minute,@myTime)) BETWEEN 0 AND 14 THEN 0 WHEN (datepart(minute,@myTime)) BETWEEN 15 AND 30 THEN 30 WHEN (datepart(minute,@myTime)) BETWEEN 31 AND 44 THEN 30 WHEN (datepart(minute,@myTime)) BETWEEN 45 AND 60 THEN 60 END, dateadd( minute, - datepart(minute, @myTime),@myTime) ) RETURN @RoundedTime END -- Usage : SELECT dbo.RoundOffHours('2010-05-11 10:01') SELECT dbo.RoundOffHours('2010-05-11 10:14') SELECT dbo.RoundOffHours('2010-05-11 10:16') SELECT dbo.RoundOffHours('2010-05-11 10:29') SELECT dbo.RoundOffHours('2010-05-11 10:31') SELECT dbo.RoundOffHours('2010-05-11 10:44') SELECT dbo.RoundOffHours('2010-05-11 10:46') SELECT dbo.RoundOffHours('2010-05-11 10:59')
Overview Scrolling to a specific element or part of a webpage is mainly done to keep a user intact with the webpage for a longer period. A scroll is a function that can be used also to scroll to the beginning of a webpage from the bottom of the webpage instantly. Instant scrolling functionality is done or implemented using JavaScript. Scrolling to a particular section of a webpage adds a single-click functionality without much intervention from the user. There are different JavaScript scroll to element methods that are used to implement the functionality of scrolling to a particular element. These methods include: JavaScript scrollIntoView method. JavaScript scroll method. JavsScript scrollTo method. In this article, we will understand them thoroughly. Introduction Before learning about the JavaScript scroll to element, Let's learn a bit about JavaScript. JavaScript is an object-oriented programming language used on web pages. JavaScript ...
Comments
Post a Comment