简体   繁体   中英

How to subtract 1 minute from hour

I have a query contains from time and to time parameters. I need to subtract 1 minute from totime parameter. I used totime-1. It is working in database level and it is not working in my crystal reports.I mean it is subtracting 1 hour in report level. Can any one please tell me other formula for subtracting a minute.

Thanks, vissu

如果您使用的是SQL Serve / T-sql


DATEADD(MI, -1, totime)

In some databases (SQL Server and Oracle for instance), you can do the following:

select totime - 1.0/(24*60)

Time differences are measured in days, so 1.0/(24*60) is one minute represented as a fraction of a day.

MySQL accepts the syntax, but the timestamp is measured in seconds not days, so you would use:

select totime - 60

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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