SQL 如何在 SSRS 报告中显示今天的日期?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/15940940/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-01 14:47:07  来源:igfitidea点击:

How do I display todays date on SSRS report?

sqlssrs-2008reporting-services

提问by Neo

I want to show up Todays dateas report generated dateon SSRS report.

我想显示Todays datereport generated date在SSRS报告。

How can i do that ?

我怎样才能做到这一点 ?

should I use any variable ?

我应该使用任何变量吗?

please help me I'm newbie to SSRS.

请帮助我,我是 SSRS 的新手。

For example refer this image: enter image description here

例如参考这张图片: 在此处输入图片说明

回答by Sooraj Chandu

date column 1:

日期列 1:

=formatdatetime(today)

回答by SQL.injection

Try this:

尝试这个:

=FORMAT(Cdate(today), "dd-MM-yyyy")

or

或者

=FORMAT(Cdate(today), "MM-dd-yyyy")

or

或者

=FORMAT(Cdate(today), "yyyy-MM-dd")

or

或者

=Report Generation Date: " & FORMAT(Cdate(today), "dd-MM-yyyy")

You should format the date in the same format your customer (internal or external) wants to see the date. For example In one of my servers it is running on American date format (MM-dd-yyyy) and on my reports I must ensure the dates displayed are European (yyyy-MM-dd).

您应该以客户(内部或外部)希望看到的相同格式来格式化日期。例如,在我的一台服务器中,它以美国日期格式 (MM-dd-yyyy) 运行,并且在我的报告中,我必须确保显示的日期是欧洲日期 (yyyy-MM-dd)。

回答by Konrad Z.

You can also drag and drop "Execution Time" item from Built-in Fields list.

您还可以从内置字段列表中拖放“执行时间”项目。

回答by Ahmed Soliman Flasha

to display date and time, try this:

要显示日期和时间,请尝试以下操作:

=Format(Now(), "dd/MM/yyyy hh:mm tt")

回答by rchacko

You can place a text-box to the report and add an expression with the following value in it:

您可以在报告中放置一个文本框,并在其中添加具有以下值的表达式:

="Report generation date:  " & Format(Globals!ExecutionTime,"dd/MM/yyyy  h:mm:ss tt" )

回答by Cordney Ervin

In the text box that contains the header, you can use an expression to get the date. Try something like

在包含标题的文本框中,您可以使用表达式来获取日期。尝试类似的东西

    ="Report Generation Date: " & Today()

right click in the text box in the layout view. At the bottom of the list you'll see the expression option. There you will be able to enter the code. This option will allow you to avoid adding a second textbox.

右键单击布局视图中的文本框。在列表底部,您将看到表达式选项。在那里您将能够输入代码。此选项将允许您避免添加第二个文本框。

回答by Robison Karls Custódio

Just simple use

只是简单的使用

=Format(today(), "dd/MM/yyyy")

will solve your problem.

将解决您的问题。

回答by Junaid Imam

  1. Inset Test box in the design area of the SSRS report.
  2. Right-click on the Textbox and scroll down and click on the Expression tab
  3. just type the given expression in the expression area: =format(Today,"dd/MM/yyyy")
  1. SSRS 报告设计区域中的插入测试框。
  2. 右键单击文本框并向下滚动并单击表达式选项卡
  3. 只需在表达式区域输入给定的表达式:=format(Today,"dd/MM/yyyy")