Get month name?
am 31.07.2006 10:55:01 von Edwin KnoppertI can't find a way to obtain the months name from a date.
Like 'August'
I can't find a way to obtain the months name from a date.
Like 'August'
Hi Edwin,
System.Globalization.DateTimeFormatInfo d =3D new =
System.Globalization.DateTimeFormatInfo();
=
string month =3D d.MonthNames[DateTime.Now.Month];
On Mon, 31 Jul 2006 10:55:01 +0200, Edwin Knoppert
=
wrote:
> I can't find a way to obtain the months name from a date.
> Like 'August'
>
>
-- =
Happy Coding!
Morten Wennevik [C# MVP]
Thanks it works however, how to use it without the culture thing?
My web.config already has the dutch culture.
DateTimeFormatInfo d = new CultureInfo("nl-NL", false).DateTimeFormat;
sVorigeMaand = d.MonthNames[DateTime.Now.AddMonths(-1).Month];
:)
"Morten Wennevik"
news:op.tdjri5x9klbvpo@tr024.bouvet.no...
Hi Edwin,
System.Globalization.DateTimeFormatInfo d = new
System.Globalization.DateTimeFormatInfo();
string month = d.MonthNames[DateTime.Now.Month];
On Mon, 31 Jul 2006 10:55:01 +0200, Edwin Knoppert
wrote:
> I can't find a way to obtain the months name from a date.
> Like 'August'
>
>
--
Happy Coding!
Morten Wennevik [C# MVP]
Got it :)
sVorigeMaand =
DateTimeFormatInfo.CurrentInfo.MonthNames[DateTime.Now.AddMo nths(-1).Month];
"Edwin Knoppert"
news:44cdd65e$0$2021$ba620dc5@text.nova.planet.nl...
> Thanks it works however, how to use it without the culture thing?
> My web.config already has the dutch culture.
>
> DateTimeFormatInfo d = new CultureInfo("nl-NL", false).DateTimeFormat;
> sVorigeMaand = d.MonthNames[DateTime.Now.AddMonths(-1).Month];
>
> :)
>
>
> "Morten Wennevik"
> news:op.tdjri5x9klbvpo@tr024.bouvet.no...
> Hi Edwin,
>
> System.Globalization.DateTimeFormatInfo d = new
> System.Globalization.DateTimeFormatInfo();
>
> string month = d.MonthNames[DateTime.Now.Month];
>
>
> On Mon, 31 Jul 2006 10:55:01 +0200, Edwin Knoppert
> wrote:
>
>> I can't find a way to obtain the months name from a date.
>> Like 'August'
>>
>>
>
>
>
> --
> Happy Coding!
> Morten Wennevik [C# MVP]
>
Warning, odd the items list starts from 0 but has a 13th item..
This is actually the current month!
sMaand =
DateTimeFormatInfo.CurrentInfo.MonthNames[DateTime.Now.AddMo nths(-1).Month];
"Edwin Knoppert"
news:44cdd65e$0$2021$ba620dc5@text.nova.planet.nl...
> Thanks it works however, how to use it without the culture thing?
> My web.config already has the dutch culture.
>
> DateTimeFormatInfo d = new CultureInfo("nl-NL", false).DateTimeFormat;
> sVorigeMaand = d.MonthNames[DateTime.Now.AddMonths(-1).Month];
>
> :)
>
>
> "Morten Wennevik"
> news:op.tdjri5x9klbvpo@tr024.bouvet.no...
> Hi Edwin,
>
> System.Globalization.DateTimeFormatInfo d = new
> System.Globalization.DateTimeFormatInfo();
>
> string month = d.MonthNames[DateTime.Now.Month];
>
>
> On Mon, 31 Jul 2006 10:55:01 +0200, Edwin Knoppert
> wrote:
>
>> I can't find a way to obtain the months name from a date.
>> Like 'August'
>>
>>
>
>
>
> --
> Happy Coding!
> Morten Wennevik [C# MVP]
>
"Edwin Knoppert"
news:44cdd65e$0$2021$ba620dc5@text.nova.planet.nl...
> DateTimeFormatInfo d = new CultureInfo("nl-NL", false).DateTimeFormat;
This is unnecessary in this instance...
> sVorigeMaand = d.MonthNames[DateTime.Now.AddMonths(-1).Month];
sVorigeMaand = DateTime.Now.AddMonths(-1).ToString("MMMM");
Hah!
Before i tried M and MM but failed :)
"Mark Rae" schreef in bericht
news:e2XBeHJtGHA.372@TK2MSFTNGP06.phx.gbl...
> "Edwin Knoppert"
> news:44cdd65e$0$2021$ba620dc5@text.nova.planet.nl...
>
>> DateTimeFormatInfo d = new CultureInfo("nl-NL", false).DateTimeFormat;
> This is unnecessary in this instance...
>
>> sVorigeMaand = d.MonthNames[DateTime.Now.AddMonths(-1).Month];
> sVorigeMaand = DateTime.Now.AddMonths(-1).ToString("MMMM");
>