英国&美国日期格式问题 [英] UK & US date format problem

查看:272
本文介绍了英国&美国日期格式问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果这篇文章看起来有点基本,我很抱歉,但我是新手,

没有访问权限。

我从Microsoft网站下载了帐户分类帐。


它允许用户查看开始&

结束日期之间的交易报告。

表和表格我相信是英国格式dd / mm / yyyy,


但是,当我点击评论报告时并输入日期为英国

dd / mm / yyyy,它什么都不返回。

如果我输入的日期为美国mm / dd / yyyy它工作正常。


我已将所有日期字段更改为英国格式,但仍然无法正常工作。


我能错过什么?


提前感谢您的帮助。

I apologise if this post seems a little basic, but I am a newbie and
have NO access knowledge.
I have downloaded the Accounts Ledger from the Microsoft Website.

It allows the user to review a report of transactions between a Start &
End date.
The Tables and forms i believe are UK format "dd/mm/yyyy",

However, when I click on "Review Reports" and enter the date as UK
"dd/mm/yyyy", it returns nothing.
If i enter the date as US "mm/dd/yyyy" it works fine.

I have changed all Date Fields to UK format, but still not working.

What could I be missing?

Thanks in advance for any assistance.

推荐答案

" Mik" < mh ***** @ safetysystemsuk.com写信息

新闻:11 ********************** @ 80g2000cwy。 googlegro ups.com ...
"Mik" <mh*****@safetysystemsuk.comwrote in message
news:11**********************@80g2000cwy.googlegro ups.com...

>如果这篇文章看起来有些基本,我很道歉,但我是新手并且

有没有访问知识。

我已从Microsoft网站下载了帐户分类帐。


它允许用户查看Start& ;;之间的交易报告。

结束日期。

我相信的表格和表格是英国格式dd / mm / yyyy,


但是,当我点击评论报告时并输入日期为英国

dd / mm / yyyy,它什么都不返回。

如果我输入的日期为美国mm / dd / yyyy它工作正常。


我已将所有日期字段更改为英国格式,但仍然无法正常工作。


我能错过什么?
>I apologise if this post seems a little basic, but I am a newbie and
have NO access knowledge.
I have downloaded the Accounts Ledger from the Microsoft Website.

It allows the user to review a report of transactions between a Start &
End date.
The Tables and forms i believe are UK format "dd/mm/yyyy",

However, when I click on "Review Reports" and enter the date as UK
"dd/mm/yyyy", it returns nothing.
If i enter the date as US "mm/dd/yyyy" it works fine.

I have changed all Date Fields to UK format, but still not working.

What could I be missing?



Access查询中的日期文字必须是美国格式或非模糊的
格式。这确保了相同的物理输入文字产生相同的

结果,无论区域设置如何。


-

Rick Brandt, Microsoft Access MVP

电子邮件(视情况而定)至...

在Hunter dot com的RBrandt

Date literals in Access queries must be either US format or a non-ambiguous
format. That ensures that the same physically entered literal produces the same
result regardless of regional settings.

--
Rick Brandt, Microsoft Access MVP
Email (as appropriate) to...
RBrandt at Hunter dot com




Rick Brandt写道:

Rick Brandt wrote:

" Mik" < mh ***** @ safetysystemsuk.com写信息

新闻:11 ********************** @ 80g2000cwy。 googlegro ups.com ...
"Mik" <mh*****@safetysystemsuk.comwrote in message
news:11**********************@80g2000cwy.googlegro ups.com...

如果这篇文章看起来有点基本,我很道歉,但我是新手,

无法访问知识。

我从Microsoft网站下载了帐户分类帐。


它允许用户查看Start&
结束日期。

我认为表格和表格是英国格式dd / mm / yyyy,


但是,当我点击查看报告并输入日期为英国

dd / mm / yyyy,它什么都不返回。

如果我输入的日期为美国mm / dd / yyyy它工作正常。


我已将所有日期字段更改为英国格式,但仍然无法正常工作。


我能错过什么?
I apologise if this post seems a little basic, but I am a newbie and
have NO access knowledge.
I have downloaded the Accounts Ledger from the Microsoft Website.

It allows the user to review a report of transactions between a Start &
End date.
The Tables and forms i believe are UK format "dd/mm/yyyy",

However, when I click on "Review Reports" and enter the date as UK
"dd/mm/yyyy", it returns nothing.
If i enter the date as US "mm/dd/yyyy" it works fine.

I have changed all Date Fields to UK format, but still not working.

What could I be missing?



Access查询中的日期文字必须是美国格式或非模糊的
格式。这确保了相同的物理输入文字产生相同的

结果,无论区域设置如何。


-

Rick Brandt, Microsoft Access MVP

电子邮件(视情况而定)至...

在Hunter dot的RBrandt com


Date literals in Access queries must be either US format or a non-ambiguous
format. That ensures that the same physically entered literal produces the same
result regardless of regional settings.

--
Rick Brandt, Microsoft Access MVP
Email (as appropriate) to...
RBrandt at Hunter dot com



谢谢...

我是否认为没有解决方案?


Thanks...
Do I assume there is no solution?




" Mik" < mh ***** @ safetysystemsuk.com写了留言

"Mik" <mh*****@safetysystemsuk.comwrote in message

谢谢...

我是否认为没有解决方案?
Thanks...
Do I assume there is no solution?



如果你创建一个硬的使用CDate()函数将日期传递给

查询或报告过滤器,它允许您使用区域

格式输入日期,因为CDate()假定为区域设置格式只要导致

a有效日期。然而,这并不强制选项以区域

格式输入,它只允许它。如果用户偏离并以某种其他格式输入日期,那么他们仍然会得到意想不到的结果。


示例:


SELECT * FROM TableName

WHERE DateField = Forms!FormName!TextBoxName


以上将始终假设输入日期的格式为美国格式除非

导致无效日期(然后会尝试其他日期)。


SELECT * FROM TableName

WHERE DateField = CDate(Forms!FormName!TextBoxName)


此查询将使用CDate()获取输入的文本并使DateTime值为

it和CDate将假设输入的格式与

Windows中的区域设置一致,除非导致无效日期(然后它会尝试其他日期)。


第二个选项排序解决了你的问题,但两者都有

的问题,除非这会导致无效的日期。最好的是以非模糊格式(如ISO(yyyy-mm-dd))格式化表单上的

条目,这是

始终解释完全相同。


日期基本上是皇家PITA,这就是为什么你看到这么多的GUI使用

日历弹出窗口和/或日期下拉列表条目。

让用户通过键盘输入日期总是一个问题。


-

Rick Brandt,微软访问MVP

电子邮件(视情况而定)至...

在Hunter dot的RBrandt com

-

Rick Brandt,Microsoft Access MVP

电子邮件(视情况而定)至...

在Hunter dot com的RBrandt

If you create a "hard" date using the CDate() function then pass that to the
query or report filter it would allow you to enter a date using your regional
format since CDate() assumes regional setting format as long as that results in
a valid date. However that doesn''t force the option to enter in regional
format, it only allows for it. If a user were to deviate and enter the date in
some other format then they could still get unexpected results.

Examples:

SELECT * FROM TableName
WHERE DateField = Forms!FormName!TextBoxName

The above will always assume the format of the entered date is US format unless
that would result in an invalid date (then it will try others).

SELECT * FROM TableName
WHERE DateField = CDate(Forms!FormName!TextBoxName)

This query will have CDate() take the text entered and make a DateTime value of
it and CDate will assume the entered format agrees with the Regional settings in
Windows unless that results in an invalid date (then it will try others).

The second option "sort of" solves your problem, but both have the issue of
"unless that would result in an invalid date". What is best is to format the
entry on the form in a non-ambiguous format like ISO (yyyy-mm-dd), which is
always interpreted exactly the same.

Dates are basically a royal PITA and that is why you see so many GUIs that use
calendar pop-ups and/or drop-lists for date entry. It is always an issue when
you let the user enter dates via the keyboard.

--
Rick Brandt, Microsoft Access MVP
Email (as appropriate) to...
RBrandt at Hunter dot com
--
Rick Brandt, Microsoft Access MVP
Email (as appropriate) to...
RBrandt at Hunter dot com


这篇关于英国&amp;美国日期格式问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆