• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 109
  • Last Modified:

use DateTime.Now to display month and year

lblSubTitle.Text = new DateTime().Month.ToString("m") + new DateTime().Year.ToString("yyyy");

Says format specifier is invalid.

Can someone tell me what I should use?  I want to display this:

"February 2015"
Tom Knowlton
Tom Knowlton
1 Solution
Tom KnowltonWeb developerAuthor Commented:
Seems like:

 lblSubTitle.Text = tempdt.ToString("MMMM yyyy");

gave me what I wanted.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now