How do I format date and time on ssrs report?

前端 未结 12 2029
野的像风
野的像风 2020-12-02 18:03

on SSRS report I need to show todays date and current time

i tried this =FormatDateTime(Now,\"MM/dd/yyyy hh:mm tt\") but this is not worki

相关标签:
12条回答
  • 2020-12-02 18:17

    If the date and time is in its own cell (aka textbox), then you should look at applying the format to the entire textbox. This will create cleaner exports to other formats; in particular, the value will export as a datetime value to Excel instead of a string.

    Use the properties pane or dialog to set the format for the textbox to "MM/dd/yyyy hh:mm tt"

    I would only use Ian's answer if the datetime is being concatenated with another string.

    0 讨论(0)
  • 2020-12-02 18:18

    hi friend please try this expression your report

    ="Page " + Globals!PageNumber.ToString() + " of " + Globals!OverallTotalPages.ToString() + vbcrlf + "Generated: " + Globals!ExecutionTime.ToString()
    
    0 讨论(0)
  • 2020-12-02 18:19

    I am using following in SSRS 2005

    =Format(Globals!ExecutionTime,"MM-dd-yyyy" & " ") 
    & CStr(Hour(Globals!ExecutionTime))  & ":"
    & CStr(Minute(Globals!ExecutionTime))
    

    Or

    =Format(Globals!ExecutionTime,"MM-dd-yyyy" & " ") 
    & Right("00" & CStr(Hour(Globals!ExecutionTime)), 2)
    & ":"
    & Right("00" & CStr(Minute(Globals!ExecutionTime)), 2)
    

    Based on comment:

    =Format(CDate(Globals!ExecutionTime), "MM-dd-yyyy hh:mm.ss") 
    

    OR

    =Format(CDate(Globals!ExecutionTime), "MM-dd-yyyy HH:mm.ss")
    
    0 讨论(0)
  • 2020-12-02 18:19

    First go to your control panel , select Date , time and Number Format . Now select English(United Kingdom) from the drop down list.

    Make sure the shor date field is equal to 'dd/mm/yyyy'. Press Apply. Now go to SSRS and right click on the report in the empty space and select properties.

    If you are using visual studio then set Language property equal to =User!Language.

    If you are using Report Builder then Language property will appear in Localization section.

    0 讨论(0)
  • 2020-12-02 18:24

    I am using this

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

    0 讨论(0)
  • 2020-12-02 18:26

    If you want date and time separate then use below expressions: Date and Time Expression

    Expression1 for current date : =formatdatetime(today) its return date is = 11/15/2016

    Expression2 for current time : =CDate(Now).ToString("hh:mm tt") its return time is = 3:44 PM

    This report printed on Expression1 at Expression2

    Output will be : Output of Both Expression

    This report printed on 11/15/2016 at 3:44 PM

    0 讨论(0)
提交回复
热议问题