简体   繁体   English

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

[英]How do I display todays date on SSRS report?

I want to show up Todays date as report generated date on SSRS report.我想在 SSRS 报告中将Todays date显示为report generated date

How can i do that?我怎样才能做到这一点?

should I use any variable?我应该使用任何变量吗?

please help me I'm newbie to SSRS.请帮助我,我是 SSRS 的新手。

For example refer this image:例如参考这张图片:在此处输入图像描述

日期列 1:

=formatdatetime(today)

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)。

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

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

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

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

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

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.此选项将允许您避免添加第二个文本框。

Just simple use只是简单的使用

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

will solve your problem.将解决您的问题。

  1. Inset Test box in the design area of the SSRS report. SSRS 报告设计区域中的插入测试框。
  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")只需在表达式区域输入给定的表达式:=format(Today,"dd/MM/yyyy")

you may use the build-in function你可以使用内置的 function

Globals!ExecutionTime

You can use built in function =Globals!ExecutionTime and make the value = [&ExecutionTime] (or whatever you want to call it)您可以使用内置的 function =Globals!ExecutionTime 并使值 = [&ExecutionTime] (或任何您想调用的名称)

You can also add the user Id of the person generating the report using the built in function您还可以使用内置的 function 添加生成报告的人员的用户 ID

=User!UserID =用户!用户ID

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

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