Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/date/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Date 现在()-仅显示月份和日期-Microsoft Access_Date_Ms Access - Fatal编程技术网

Date 现在()-仅显示月份和日期-Microsoft Access

Date 现在()-仅显示月份和日期-Microsoft Access,date,ms-access,Date,Ms Access,当我在Access:Now()中使用此函数时,它返回以下内容:27-04-2012 10:03:09 如何制作一个只显示月份和日期的函数,如下所示:27-04示例:表中的一个字段是DOB,然后您需要它只输出日期和月份。所以,您需要选择数据类型Date/Time,然后您应该设置字段属性和常规选项卡的格式,然后像这样输入:dd mmmm 希望它能帮助您。示例:表中的一个字段是DOB,然后您需要它只输出日期和月份。所以,您需要选择数据类型Date/Time,然后您应该设置字段属性和常规选项卡的格式,然

当我在Access:Now()中使用此函数时,它返回以下内容:27-04-2012 10:03:09


如何制作一个只显示月份和日期的函数,如下所示:27-04

示例:表中的一个字段是DOB,然后您需要它只输出日期和月份。所以,您需要选择数据类型Date/Time,然后您应该设置字段属性和常规选项卡的格式,然后像这样输入:dd mmmm


希望它能帮助您。

示例:表中的一个字段是DOB,然后您需要它只输出日期和月份。所以,您需要选择数据类型Date/Time,然后您应该设置字段属性和常规选项卡的格式,然后像这样输入:dd mmmm


希望它能对您有所帮助。

如果您正在寻找以日-月格式返回日期的函数,则可以执行以下操作:

Public Function test()
    Dim testdate As String
    test = Format(Day(Now()), "00") & "-" & Format(Month(Now()), "00")
End Function

Result:
29-04
如果要在查询中使用日期格式,可以执行以下操作:

select (Format(Day(Now()), "00") & "-" & Format(Month(Now()), "00")) as DayMonth
From yourtable


如果您正在寻找以day month格式返回日期的函数,则可以执行以下操作:

Public Function test()
    Dim testdate As String
    test = Format(Day(Now()), "00") & "-" & Format(Month(Now()), "00")
End Function

Result:
29-04
如果要在查询中使用日期格式,可以执行以下操作:

select (Format(Day(Now()), "00") & "-" & Format(Month(Now()), "00")) as DayMonth
From yourtable


在Access中很酷,但当我在网站上提取日期时,它会显示年份、小时、分和秒:(对不起,我只知道access中的日期。但我认为当你在网站上提取日期时,也许你应该重新格式化。这在access中很酷,但当我在网站上提取日期时,它会显示年、小时、分和秒:(对不起,我只知道access中的日期。但我认为,当你在网站上提取日期时,也许你应该重新格式化它。@HansUp,因为我写它时处于半睡眠状态,没有明显思考。:)更新以添加该查询。@HansUp,因为我写它时处于半睡眠状态,没有明显思考。:)更新以添加该查询。