将当前日期转换为第 n 个

Convert current date to nth

如何将 October 24, 2018 转换为 24th of October, 2018

我想你需要一个公式。不知道有没有现成的功能。在英语中,你可以这样做:

NumberVar DayIn := Day ({YourTable.YourDate});
Totext (DayIn , 0 )
& (if DayIn in 4 to 20 then 'th' else
if remainder (DayIn , 10) = 1 then 'st' else
if remainder (DayIn , 10) = 2 then 'nd' else
if remainder (DayIn , 10) = 3 then 'rd' else 'th')
& " of "
& Totext ({YourTable.YourDate}, "MMMM, yyyy")

这需要将自定义样式应用于显示日期的字段。要创建此字段,请右键单击该字段并单击 "Format Field"。在格式编辑器的日期选项卡上单击自定义按钮。

您现在应该会看到自定义样式 window。

在“格式”组中设置“月份”以使用月份的长名称。
在订单组中单击 DMY 的单选按钮。 在分隔符组中,单击标记为 "First:" 的字段的 X-2 按钮并输入以下公式:

If Right(ToText(Day({GLPREPOST.START_DATE}),0,""),1) = "1" Then
    "st of "
Else If Right(ToText(Day({GLPREPOST.START_DATE}),0,""),1) = "2" Then
    "nd of "
Else If Right(ToText(Day({GLPREPOST.START_DATE}),0,""),1) = "3" Then
    "rd of "
Else 
    "th of "

{GLPREPOST.START_DATE} 替换为数据库中包含您正在设置格式的日期的字段的引用。

您还需要在标记为 "Second:" 的字段的分隔符组中输入 space。

单击“确定”按钮保存您的自定义样式。

此时您的日期应按要求显示。 :)