Convert Seconds to Minutes

Posted: March 31, 2011 in SQL Server 2005

Run the following script to convert seconds to minutes showing the upper and lower ranges:

-- Declare variables
DECLARE @ln_seconds INT;

-- Initialise variables
SET @ln_seconds = 61;

-- Upper whole number
SELECT CEILING(CAST(@ln_seconds AS FLOAT) / 60);

-- Lower whole number
SELECT FLOOR(CAST(@ln_seconds AS FLOAT) / 60);
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s