反馈已提交

网络繁忙

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

Convert year-month-day date format to year-month

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

    1.1 Expected effect

    The effect of converting the year-month-day date format to month is shown in the following table.

    Before
    After
    2020-02-02202002
    2020/02/02
    2020-02-02 00:00:00

    1.2 Implementation idea

    1)In the Self-Service dataset, add the date field that needs to be converted.

    2)In the new column, add a combination of the REPLACE function and the LEFT function to get the year and month format.

    2. Operation steps

    Example data: "Industry Data>Estate Indusrty>FACT_SALE_CONTRACT"

    2.1 Create a new Self-Service dataset

    Process the data in the Self-Service dataset. Click "Data Preparation" and add "Self-Service dataset" under "Package". As shown in the figure below.

    image.png

    2.2 Select fields

    In the new Self-Service dataset, add the "Signing Time" date field and the rest fields of the "FACT_SALE_CONTRACT" table. As shown in the following figure.

    image (1).png

    2.3 New column

    Add "New column" to convert the "Signing Time" field to year/month format. The following figure shows.

    image (2).png

    2.4 Add formula

    1)You can name a new column as  "year-month-day", enter the formula: REPLACE(LEFT(Signing Time,7), LEFT(Signing Time,5), LEFT(Signing Time,4)). Click "OK" to finish. As shown in the figure below.

    Note: In the formula, you need to click on the "time field" under the corresponding field to enter, not through the rest of the way to enter.

    The formula description is shown in the following table.

    Formula
    DescriptionExampleDetail
    LEFT(DATE,7)Truncate the first 7 characters of the "DATE" field2010-02-17 00:00:00 After intercepted as "2010-02LEFT(): return the first few characters of the string according to the specified number of characters
    REPLACE(LEFT(DATE,7),LEFT(DATE,5),LEFT(DATE,4))Convert the first 7 bits of the "Signing Time" field to the target string, and convert the first 5 characters of the string to the first 4 characters.Intercept "2010-02" in 2010-02-17 00:00:00, replace "2010-" with "2010" in 2010-02 to get "201002"REPLACE(): according to the selected string, replace the content in the original text with other text

    image (3).png

    Note: The date format of 2020-02-02 or 2020/05/22 or 2020-02-02 00:00:00 can be converted using the above formula.

    2)After adding the formula, name the Self-Service dataset and click "Save" to complete the date conversion. The effect is shown in the following figure.

    image (4).png

    3)The data can be viewed after "Update Data", as shown in the following figure.

    image (5).png

    3. Effect view

    After converting the year-month-day hour-minute-second date format to year-month, the effect is shown in the following figure.

    image (6).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后关闭