Date functions are widely used in work and life, and so are the adding or subtracting of specified time intervals in time fields.
For applications of date functions provided by FineBI, see Overview of Date Functions.
This document introduces how to calculate the time field N hours/minutes/seconds after a specified time.
Use the TODATE and DATETONUMBER functions in combination.
Create an analysis subject and add any dataset. Add a Formula Column and enter the formula NOW() to get the current time.
To calculate the time two hours, two minutes, and two seconds after the Current Time field, you can add formula columns and enter the following formulas respectively.
TODATE(DATETONUMBER(Current Time)+2*3600*1000)
Calculates the time two hours after the current time.
TODATE(DATETONUMBER(Current Time)+2*60*1000)
Calculates the time two minutes after the current time.
TODATE(DATETONUMBER(Current Time)+2*1000)
Calculates the time two seconds after the current time.
The following table explains each formula in detail.
Number
Formula
Explanation
1
TODATE(DATETONUMBER(Current Time)+N*3600*1000)
Converts the Current Time to milliseconds, adds the millisecond form the time interval (N hours * 3600 seconds per hour * 1000 milliseconds per second), and converts the result to a standard date value with the TODATE function.
2
TODATE(DATETONUMBER(Current Time)+N*60*1000)
Converts the Current Time to milliseconds, adds the millisecond form the time interval (N hours * 60 seconds per minute * 1000 milliseconds per second), and converts the result to a standard date value with the TODATE function.
3
TODATE(DATETONUMBER(Current Time)+N*1000)
Converts the Current Time to milliseconds, adds the millisecond form the time interval (N hours * 1000 milliseconds per second), and converts the result to a standard date value with the TODATE function.
Click Save All and Update. The result is shown in the following figure.
滑鼠選中內容,快速回饋問題
滑鼠選中存在疑惑的內容,即可快速回饋問題,我們將會跟進處理。
不再提示
10s後關閉
Submitted successfully
Network busy