I. Description
In our daily report design, one of the most commonly used widgets is the "Date" widget, but because of the various needs, the form of time display is also different.
Here, I would like to share some known display forms with you, and welcome you to add documents.
II. Show time of day
In the Attribute> Widget Value of the date widget, define the formula as =today() to customize the end time to the current day, as shown in the following figure:
III. Show custom year
1) Method 1:
Click the cell, right-click and select Attributes>Display>Data Dictionary, or use the range() function in the cell Attributes>Display>Data Dictionary on the right to display the year, save the template, click Preview on the PC, and the return result is 2017. As shown below:
2) Method 2:
For example, the date field in our database is 2017-01-01, when we only want to use the year, there are two ways:
LEFT() function: input =LEFT(2017-01,4) in the cell, intercept 4 from the left as a string, and the return value is 2017.
YEAR() function: enter =YEAR('2017-01-01') in the cell, return the year in the date, and the return value is 2017.
IV. Get the current time
Get the year, month, and day of the date through the three functions: year(), month(), and day().
Get the current year: enter =year(now()) in the cell to return the result 2017.
Get the current month: enter =month(now()) in the cell to return the result 02.
Get the current day: input =day(now()) in the cell to return the result 14.
Note: If year(), month(), day() correspond to year\month\day with decimals, it will return the current year or month or day, which is equivalent to year(today()), month(today()), day(today()).
V. Return the Chinese week number of the date
The four functions of FORMAT(), SWITCH(), WEEKDAY() and DATE() can be used to return the Chinese week number of the date.
Enter =FORMAT(DATE(2017,03,06), "EEEEE") in the cell to return the result: Monday.
Enter =SWITCH(WEEKDAY(DATE(2017,03,06)),1,'Monday',2,'Tuesday',3,'Wednesday',4,'Thursday',5,'Friday',6,'Saturday',0,'Sunday') in the cell return result: Monday.
VI. Special format conversion of date
Use the FORMAT() function for format conversion.
Current year, month, day and week: Enter =FORMAT(today(),"yyyy year MM month dd day EEEEE") in the cell, and the result will be returned: Friday, December 25, 2020.
Current year: enter =FORMAT(today(),"yyyyyear") in the cell, and the result will return: 2020.