简体   繁体   English

SSRS 2008 R2 Report Builder 3.0:偏移日期默认开始时间

[英]SSRS 2008 R2 Report Builder 3.0: Offset Date Default Start Time

I allow the user to enter in what start date and end date they need.I set my start and end date parameters to @Start and @End. 我允许用户输入所需的开始日期和结束日期。我将开始日期和结束日期参数设置为@Start和@End。 They have no values stored in them, rather in my code I have ....Between @Start and @End. 它们中没有存储任何值,而是在我的代码中,....介于@Start和@End之间。 The dates entered by the user gets passed into my program instead of me specifying what the user is allowed to enter in the parameter properties. 用户输入的日期将传递到我的程序中,而不是由我指定允许用户在参数属性中输入的日期。 My problem is I want the default start of each date picked to be 5:00 AM Instead of 0:00 AM. 我的问题是我希望每个日期的默认开始时间是5:00 AM,而不是0:00 AM。 This way when the user picks for example: 2/20 and 2/21, they can retrieve date from 5:00 AM- 5:00 AM. 这样,当用户选择2/20和2/21时,他们可以从5:00 AM- 5:00 AM检索日期。 This enables my program to show data past midnight, which is necessary because my data stops at 3:00 AM. 这使我的程序可以显示午夜之后的数据,这是必要的,因为我的数据在3:00 AM停止。

You can use the DateAdd function to add 5 hours to get 2/20/2013 5:00 AM 您可以使用DateAdd函数添加5小时来获得2/20/2013 5:00 AM

Look at this: 看这个:

=DateAdd("h",5,Parameters!StartDate.Value)

Edit 编辑

you can add this line of code in one of the following: 您可以通过以下方式之一添加此代码行:

Dataset's parameters section 数据集的参数部分

  • Right click on your dataset 右键单击您的数据集
  • click on parameters section 点击参数部分
  • Click on the FX button, and put there the line of code 单击FX按钮,然后在此处放置代码行

Use this when you use parameters to filter your SQL query 使用参数过滤SQL查询时使用此方法

Report's field (ie textbox, table cell etc..) 报告的字段(即文本框,表格单元格等)

  • Right click on the field 右键单击该字段
  • Click on the field expression option, and put there the line of code 单击字段表达式选项,然后在此处放置代码行

The result looks like that: 结果看起来像这样: 在此处输入图片说明

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM