Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Truncate Minute

Status
Not open for further replies.

pflakes

Technical User
Jan 27, 2004
31
US
Is there a simple way to truncate the current time to the minute using the getdate() function.

I need to run a procedure every minute and make calculations on the previous minute --

ie. At 2:12 I need to calculate the values for
>= 2:11 and < 2:12. getdate() is going to return something like 2:12:45.234. I need the value 2:12:00 returned.

What is the simplest way to go about this?
 
smallDateTime is the nearest minute

DECLARE @theTime smallDateTime
SELECT @theTime = getDate()

Programming today is a race between software engineers striving to build better and bigger idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning. - Rick Cook (No, I'm not Rick)

zen.gif
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top