一年中一周的报告服务表达式
我有一个报告,我将参数发送到“WeekStart”。这是基于用户在日期选择器上所做的选择。
我使用以下内容来提取一年中的第几周:
=DatePart("ww", 参数!WeekStart.Value)
我遇到的问题是,当我选择日期 03/01/2012(dd/MM/yyyy 格式)时,一年中的第几周返回为 9,从技术上讲,如果日期是03/01/2012,日期格式为 MM/dd/yyyy。
我尝试过使用 CDate、FormatDateString 等,但似乎没有任何效果。我要么收到 #Error,要么在一年的第 9 周返回。
有什么建议吗?
I have a Report that I send a parameter to as 'WeekStart'. This is based on a selection a user makes on a datepicker.
I'm using the following to extract the week of the year:
=DatePart("ww", Parameters!WeekStart.Value)
The problem I'm having is that when I pick the day 03/01/2012 (dd/MM/yyyy format), the week of the year is returned as 9, which would technically be true had the date been 03/01/2012 with a dateformat of MM/dd/yyyy.
I've tried using CDate, FormatDateString etc but nothing seems to be working. I either get #Error or it returns as the 9th week of the year.
Any suggestions?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以做的是:
这将为您的数据库设置日期格式,并且应该使您的
DATEPART
函数按预期工作。设置日期格式 (MSDN)
What you can do is this:
That will set the date format for your database, and that should get your
DATEPART
function working as expected.SET DATEFORMAT (MSDN)