-2

I've been programming in PHP for quite some time and now I'm trying to learn a new language. I'm creating a webpage and I want to display the current month automatically. In asp.net is the a way to do that? If there's a way can you guys help me?

user2985255
  • 99
  • 1
  • 1
  • 8
  • 1
    Possible duplicate of [C# DateTime to "YYYYMMDDHHMMSS" format](http://stackoverflow.com/questions/3025361/c-sharp-datetime-to-yyyymmddhhmmss-format) – VDWWD May 09 '17 at 06:51

3 Answers3

1

DateTime.Now.ToString("MMMM") should do the job.

Here you have more info about date formats in .NET https://msdn.microsoft.com/en-us/library/az4se3k1(v=vs.80).aspx

hardkoded
  • 18,915
  • 3
  • 52
  • 64
0

If the date is 05/08/2017 and I need to get 04/08/2017 I use something like...

 DateTime d = DateTime.Now;
 d = d.AddMonths(-1);

this is get the date and subtract a month.

PhatLee
  • 37
  • 9
-1

Somehow someone -1d my question. The link that was provided only show how to display the date not how to subtract a month which is quite different!!!!

user2985255
  • 99
  • 1
  • 1
  • 8