I have a Text box containing the following info:
="Effective: " & Parameters!PMStartDate.Value & " to "
& Parameters!PMEndDate.Value
How do I control the format of the date? I want the Format to be dd/MMM/yyyy.You will need to use Format(). See
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vblr7/html/vafctFormat.asp
for more information.
Below is a sample expression based on your parameter names:
="Effective: " & Format(Parameters!PMStartDate.Value, "Long Date") & "
to " & Format(Parameters!PMEndDate.Value, "Short Date")
--
Bruce Johnson [MSFT]
Microsoft SQL Server Reporting Services
This posting is provided "AS IS" with no warranties, and confers no rights.
"SAcanuck" <SAcanuck@.discussions.microsoft.com> wrote in message
news:9A6A54AE-1EE6-4A94-9A5C-244E77DD42A8@.microsoft.com...
> I have a Text box containing the following info:
> ="Effective: " & Parameters!PMStartDate.Value & " to "
> & Parameters!PMEndDate.Value
> How do I control the format of the date? I want the Format to be
dd/MMM/yyyy.|||Try this:
1. Pull up the report properties dialog, go to the code tab, and paste the
following into the code textbox:
public shared Function Convert(dt As datetime) As String
return dt.ToString("dd/MM/yyyy")
End Function
2. Paste the following into the textbox in question: ="Effective: " &
Code.Convert(Parameters!PMStartDate.Value) & " to " &
Code.Convert(Parameters!PMEndDate.Value)
The .NET datetime format strings are explained in detail in
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cpconcustomdatetimeformatstrings.asp?frame=true.
--
Ravi Mumulla (Microsoft)
SQL Server Reporting Services
This posting is provided "AS IS" with no warranties, and confers no rights.
"SAcanuck" <SAcanuck@.discussions.microsoft.com> wrote in message
news:9A6A54AE-1EE6-4A94-9A5C-244E77DD42A8@.microsoft.com...
> I have a Text box containing the following info:
> ="Effective: " & Parameters!PMStartDate.Value & " to "
> & Parameters!PMEndDate.Value
> How do I control the format of the date? I want the Format to be
dd/MMM/yyyy.|||My favorite way of formatting strings is
=String.Format("From {0:d} to {1:d}", Parameters!
From.Value, Parameters!To.Value)
>--Original Message--
>I have a Text box containing the following info:
>="Effective: " & Parameters!PMStartDate.Value & " to "
>& Parameters!PMEndDate.Value
>How do I control the format of the date? I want the
Format to be dd/MMM/yyyy.
>.
>
Monday, March 19, 2012
Formatting Dates
Labels:
box,
containing,
control,
database,
dates,
effective,
following,
formatting,
microsoft,
mysql,
oracle,
parameterspmenddate,
parameterspmstartdate,
server,
sql,
text,
value
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment