反馈已提交

网络繁忙

You are viewing 5.1 help doc. More details are displayed in the latest help doc.

Date n(h/min/sec) after the specified date

  • Recent Updates: April 15, 2022
  • 1.Overview

    1.1 Problem description

    Date function is widely used in daily work and life. It is particularly important to add or subtract the specified time interval from the date.

    At present, the use of some date functions is provided. See date function for more details.

    However, sometimes it is necessary to obtain "the date of n (hours / minutes / seconds) after the specified date". How to deal with it?

    1.2 Implementation ideas

    Combine function TODATE and DATETONUMBER to calculate.

    2. Examples

    2.1 Add new fields

    Create a self-service dataset. Take the current time now() = 「2021-07-27 14:11:16」" as an example, and use "add field" to obtain the date values after 2 hours, 2 minutes and 2 seconds respectively. The formula is shown in the following figure:

    新增字段.png

    Similarly: add the field "after 2 hours, after 2 minutes, after 2 seconds", and the formulas are as follows:

    FormulaInterpretation
    TODATE(DATETONUMBER(A1)+ 2 * 3600 * 1000)after 2 hours
    TODATE(DATETONUMBER(A1)+ 2 * 60 * 1000)after 2 minutes
    TODATE(DATETONUMBER(A1)+ 2 * 1000)after 2 seconds

    两小时后.png

    Formula interpretation:

    No.FormulaInterpretation
    1=TODATE(DATETONUMBER(current time)+ N * 3600 * 1000)Convert the current time to millisecond level + n hours * 3600 seconds per hour * 1000 milliseconds per second, and finally convert it to standard date value through TODATEfunction
    2=TODATE(DATETONUMBER(A1)+ N * 60 * 1000)Convert the current time into millisecond level + n minutes * 60 seconds per minute * 1000 milliseconds per second, and finally convert it into standard date value through TODATEfunction
    3

    =TODATE(DATETONUMBER(A1)+ N *1000)

    Convert the current time to millisecond level + N seconds * 1000 milliseconds per second, and finally convert it to standard date value through TODATEfunction

    Note: the fields in the formula need to be selected from the field box on the left and cannot be entered manually.

    2.2 View the effect

    Save the self-service dataset, the effect is as shown in the following figure:

    效果查看.png

    Attachment List


    Theme: Data Processing
    Already the First
    Already the Last
    • Helpful
    • Not helpful
    • Only read

    售前咨询电话

    400-811-8890转1

    在线技术支持

    在线QQ:800049425

    热线电话:400-811-8890转2

    总裁办24H投诉

    热线电话:173-1278-1526

    文 档反 馈

    鼠标选中内容,快速反馈问题

    鼠标选中存在疑惑的内容,即可快速反馈问题,我们将会跟进处理。

    不再提示

    10s后关闭