DateFormula Data Type
Version: Available or changed with runtime version 1.0.
Represents a date formula that has the same capabilities as an ordinary input string for the CALCDATE Method (Date). The DateFormula data type is used to provide multilanguage capabilities to the CALCDATE Method (Date).
Remarks
When a date calculation formula is stored in a DateFormula field, it is converted to a generic, non-language dependent format. When a date calculation formula is retrieved from a DateFormula field, it is converted to a valid date conversion string for the currently selected language.
To assign a value to a DateFormula data type, whether it is a field or a variable, you must use the Evaluate Method.
The following table shows the syntax that is used to create the date formula.
Syntax | Description |
---|---|
30D | 30 days |
2W | 2 weeks |
CM+10D | Current month plus 10 days |
CM+1M | Current month plus one month |
CQ+1M+20D | Current quarter plus one month plus 20 days |
CW+1W | Current week plus one week |
D15 | On the 15th of each month |
In Business Central, weeks begin on Monday and end on Sunday.
Example
This example requires that you create a DateFormulaVariable variable that is a DateFormula data type.
if Format(DateFormulaVariable) = '' then
Evaluate(DateFormulaVariable, '<1W>');
You must use the Format Method to make a comparison with a text string. If you do not use this method, then the if
statement will fail because you cannot compare a DateFormula data type with a Text data type.
See Also
反馈
https://aka.ms/ContentUserFeedback。
即将发布:在整个 2024 年,我们将逐步淘汰作为内容反馈机制的“GitHub 问题”,并将其取代为新的反馈系统。 有关详细信息,请参阅:提交和查看相关反馈