Solved

use DateTime.Now to display month and year

Posted on 2015-02-10
1
79 Views
Last Modified: 2015-02-10
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"
0
Comment
Question by:knowlton
1 Comment
 
LVL 5

Accepted Solution

by:
knowlton earned 0 total points
ID: 40601804
Seems like:

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

gave me what I wanted.
0

Featured Post

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my asp.net applications, I have grown tired of the following syntax:      (CODE) I suppose it just offends my sense of decency to put inline VBScript on a…
Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
In a recent question (https://www.experts-exchange.com/questions/28997919/Pagination-in-Adobe-Acrobat.html) here at Experts Exchange, a member asked how to add page numbers to a PDF file using Adobe Acrobat XI Pro. This short video Micro Tutorial sh…

810 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question