Expression for Date TimeStamp

  • I have a report that uses the folowing expression in a date timestamp field to format the date as either US format or European format depending on a Language prompt the user selects:

    =iif(Parameters!LANG.Value = "EN", ToDateTime(Fields!TRANS_DATE.Value).ToString("MM/dd/yyyy"), ToDateTime(Fields!TRANS_DATE.Value).ToString("dd-MM-yyyy"))

    If he user selects English, April 1st appears as 04/01/16. If they select any other format, the date appears as 01-04-16. Works great.

    I would like to do the same thing on another field but I would like to leave the time in the results. So, if the user selects English, the results would display 04-01-16 11:15:23 AM. Otherwise, I would like to see 01-04-16 11:15:23 AM.

    Can I modify the expression above to do the same thing but leave the hours and minutes and seconds in the result? I'm using Report Builder 3.0

    Thanks for your help.......

  • instead of ToString("MM/dd/yyyy")

    you can add the hours, minutes ...

    ToString("MM/dd/yyyy hh:mi:ss")

    *Have yet to lookup the correct formatting string

  • Thanks for the suggestion. I'll give that a try

  • You can use this instead

    Format(Fields!TRANS_DATE.Value, "MM/dd/yyyy")

  • Thanks.........I'll try that suggestion as well

Viewing 5 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic. Login to reply