Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to truncate seconds in TSQL?

Tags:

datetime

tsql

I have time, select cast(SYSDATETIME() AS time) 14:59:09.2834595

What is the way to truncate seconds? 14:59

like image 392
ob213 Avatar asked Jan 06 '12 21:01

ob213


1 Answers

Description

You can use the T-SQL function convert.

Sample

PRINT convert(varchar(5), SYSDATETIME(), 108)

will give you hh:mm

More Information

  • MSDN - CAST and CONVERT
like image 120
dknaack Avatar answered Sep 29 '22 13:09

dknaack