在Access中更改日期格式 [英] Change format of date in Access
问题描述
亲爱的社区
我的Access数据库包含一个包含日期的表。例如01.01.2006。 (数据类型:日期/时间)
该日期在前端的表单中可见。我只希望年份(2006年)的形式而不是整个日期。我知道这是可能的,但我不知道如何以及在何处做到这一点。你能帮我吗?
或者我应该把数据类型改成文本吗?并且只填写表中没有01.01的年份。我很害怕,如果是这样的话,我再也不能用这个日期来查询...
非常感谢
Mike
Dear Community
My Access database contains a table with dates. For example 01.01.2006. (data type: "Date/Time")
That date is visible in a form in the front end. I only would like to have the year (2006) in the form and not the whole date. I know that this is possible, but I do not know how and where exactly to do that. Could you please help me?
Or should I change the data type into "text" and only fill in the year in the table without "01.01."? I am afraid, that if so I can''t use this date for queries anymore...
Thanks a lot
Mike
推荐答案
如果表格真正包含类型日期/时间,则它应显示为01/01/2006。因此,如果你看到01.01.2006已被格式化的某个地方(在表格或表格中)
要仅查看年份,请使用
If the table genuinely contains Type Date/Time, then it should appear as 01/01/2006. So if you are seeing 01.01.2006 that has been formatted somewhere along the line (either in the table or in the form)
To only see the year, use
亲爱的朋友
谢谢。我必须在哪里填写格式(MyDate,yyyy),这是属于属性还是确切位置?
Mike
Dear Phil
Thank you. Where exactly do I have to fill in "Format(MyDate, "yyyy")", is this under properties or where exactly?
Mike
>
假设你有一个基于查询的表单,在查询中添加一个名为MyYear的字段(年份是一个保留字,应该避免)
所以在查询中有:
Assuming you have a form based on a Query, add a field to the query called MyYear (Year is a reserved word and should be avoided)
So in the Query to have:
这篇关于在Access中更改日期格式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!