Return current month string.

1 Answer 771 Views
Report Designer (standalone)
Michael
Top achievements
Rank 1
Iron
Iron
Michael asked on 07 Jun 2021, 04:36 PM

I am trying to get the month returned in a string in a report parameter. I currently have

Now().Month

But I suspect it is returning the number of the month because the field is blank when I run the report, which is strange because the other report parameter is

Now().Year
and that works just fine. I tried formatting as a string, but that did not work either. What am I doing wrong?

1 Answer, 1 is accepted

Sort by
1
Accepted
Plamen Mitrev
Telerik team
answered on 08 Jun 2021, 10:11 AM

Hello Michael,

The Now() function actually returns a DateTime object and you can adjust the end result in the Report Designer according to the documentation. By default, the expression "Now().Month" returns the current month on this machine as a number from 1 to 12. You can choose the format of the returned month and convert it to string at the same time with the sample expressions below.

= Now().ToString("MMMM") //returns the full month name
= Now().ToString("MMM") //returns the shortened month name up to 3 characters

Please try the above suggestions and configure the expression for your requirements. Let me know if you need further assistance.

Regards,
Plamen Mitrev
Progress Telerik

Brand new Telerik Reporting course in Virtual Classroom - the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products. Check it out at https://learn.telerik.com/.
Michael
Top achievements
Rank 1
Iron
Iron
commented on 08 Jun 2021, 03:27 PM

Thank you, this is exactly what I needed, I was missing ToString.
Plamen Mitrev
Telerik team
commented on 09 Jun 2021, 12:32 PM

I am happy to hear that you can now get the exact output that you need! 
Tags
Report Designer (standalone)
Asked by
Michael
Top achievements
Rank 1
Iron
Iron
Answers by
Plamen Mitrev
Telerik team
Share this question
or