如何在MS Access中格式化Union Query的日期字段?

时间:2021-10-12 09:10:50

I have two tables with date fields. Each table displays the date in Short Date format (MM/DD/YYYY).

我有两个带日期字段的表。每个表格以短日期格式(MM / DD / YYYY)显示日期。

I wrote a Union Query to combine these tables, but the Union query displays the date in General Date (long) format (MM/DD/YYYY HH:MM:SS). I would be grateful for a solution to getting dates out of the Union Query in Short Date format.

我写了一个Union Query来组合这些表,但是Union查询以General Date(long)格式显示日期(MM / DD / YYYY HH:MM:SS)。我将很感激能够以短日期格式从联合查询中获取日期的解决方案。

3 个解决方案

#1


do a select on the union and format the date column at the end:

对联合执行选择并在结尾处格式化日期列:

select format(foo, "short date")
from (
    blah
union
    blah
)

#2


There's a nice built in Jet function you can use:

你可以使用一个很好的内置Jet功能:

Select Format(myDate, 'mm/dd/yyyy') From Table

从表格中选择格式(myDate,'mm / dd / yyyy')

Hope this helps!

希望这可以帮助!

#3


If you are using a querydef, you can right-click on the column in Design Mode and you will find a Format property.

如果您使用的是querydef,则可以在设计模式中右键单击该列,您将找到Format属性。

#1


do a select on the union and format the date column at the end:

对联合执行选择并在结尾处格式化日期列:

select format(foo, "short date")
from (
    blah
union
    blah
)

#2


There's a nice built in Jet function you can use:

你可以使用一个很好的内置Jet功能:

Select Format(myDate, 'mm/dd/yyyy') From Table

从表格中选择格式(myDate,'mm / dd / yyyy')

Hope this helps!

希望这可以帮助!

#3


If you are using a querydef, you can right-click on the column in Design Mode and you will find a Format property.

如果您使用的是querydef,则可以在设计模式中右键单击该列,您将找到Format属性。