简体   繁体   English

如何用小数点将秒转换为分钟

[英]How to convert seconds to minutes with decimal point

I have column that presents number of seconds that took to complete scanning.我有一列显示完成扫描所需的秒数。 However I need to translate to minutes and remaining seconds, example if we have 65 seconds I need function to convert to 1.5.但是我需要转换为分钟和剩余秒数,例如,如果我们有 65 秒,我需要 function 转换为 1.5。 I have used datediff() function to retract minutes from start and end datetime stamp but it rounds to nearest minutes.我已经使用 datediff() function 从开始和结束日期时间戳中撤回分钟,但它会四舍五入到最接近的分钟。

That is really strange, but you can use strings:这真的很奇怪,但你可以使用字符串:

select floor(65 / 60) || '.' || (65 % 60)

Note: This uses standard operators but databases may have their own conventions for string concatenation and modulo arithmetic.注意:这使用标准运算符,但数据库可能有自己的字符串连接和模运算约定。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM