Date of data: {Parameters.BeginDate.Value} to {Parameters.EndDate.Value}
When the user selects both dates and generate the report, the textbox displays
Date of data: 4/1/2012 12:00:00 AM to 4/2/2012 12:00:00 AM
I do not want the timestamp showing up as the user is only selecting a date. I tried to apply formating to the textbox {0:d} but that didn't work.
Any suggestions?
8 Answers, 1 is accepted
Parameters.BeginDate.Value.Date
or alternatively Format("{0:MM/dd/yyyy}",Parameters.BeginDate.Value.Date), I believe {0:d} gives you the day of the month.
Hi, Stephen!
Thank you verry much! :)
Parameters.BeginDate.Value.Date
or alternatively Format("{0:MM/dd/yyyy}",Parameters.BeginDate.Value.Date), I believe {0:d} gives you the day of the month.[/quote]
Thank you. This helped me format the Date Range in my report.
[quote]Edwin said:You might try something like:
Parameters.BeginDate.Value.Date
or alternatively Format("{0:MM/dd/yyyy}",Parameters.BeginDate.Value.Date), I believe {0:d} gives you the day of the month.
[/quote]
Hi,
I am trying to test second solution in textbox like this:
From {Format("{0}",Parameters.Od.Value.Date)} to {Parameters.Do.Value}
But when adding "{0}" to inside expression I got error:
Telerik.Reporting.Processing.Expressions.EmbeddedExpressionsException: Error evaluating embedded expressions: Unexpected token inside an expression at index 46
How can I escape {} when passing argument to Format()?
Thanks,
Łukasz
If used in a string literal, curly brackets - { } should be escaped with double brackets like this: {{ or }}. More information on the topic can be found in the Embedded Expressions help article.
Regards,
Nasko
Telerik
Hi, I'm also having the same issue when formatting a DateTime parameter in a TextBox.
Here's what I have:
Estimates - from {Format("{0:dd/MM/yyyy}", Parameters.startDate.Value.Date)} to {Parameters.endDate.Value}
and I get the following error:
ReportNameTextBox.Value expression [Estimates - from {Format("{0:dd/MM/yyyy}", Parameters.startDate.Value.Date)} to {Parameters.endDate.Value}] is not valid: Error evaluating embedded expressions: Unexpected token inside an expression at index 29
Hi Robert,
Try {Format("{{0:dd/MM/yyyy}}", Parameters.startDate.Value.Date)} instead of {Format("{0:dd/MM/yyyy}", Parameters.startDate.Value.Date)}.
Thanks
Vivek
Hi Vivekveer,
Do you know how to format date but keeps Globalization in place. Set the format, when runs in US see US date format when runs in UK see UK date format etc. Thanks.