473,473 Members | 2,026 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Get month name?

I can't find a way to obtain the months name from a date.
Like 'August'
Jul 31 '06 #1
6 7219
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 <ne**@hellobasic.com>
wrote:
I can't find a way to obtain the months name from a date.
Like 'August'



--
Happy Coding!
Morten Wennevik [C# MVP]
Jul 31 '06 #2
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" <Mo************@hotmail.comschreef in bericht
news:op***************@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 <ne**@hellobasic.com>
wrote:
I can't find a way to obtain the months name from a date.
Like 'August'



--
Happy Coding!
Morten Wennevik [C# MVP]
Jul 31 '06 #3
Got it :)

sVorigeMaand =
DateTimeFormatInfo.CurrentInfo.MonthNames[DateTime.Now.AddMonths(-1).Month];
"Edwin Knoppert" <ne**@hellobasic.comschreef in bericht
news:44**********************@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" <Mo************@hotmail.comschreef in bericht
news:op***************@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 <ne**@hellobasic.com>
wrote:
>I can't find a way to obtain the months name from a date.
Like 'August'


--
Happy Coding!
Morten Wennevik [C# MVP]

Jul 31 '06 #4
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.AddMonths(-1).Month];

"Edwin Knoppert" <ne**@hellobasic.comschreef in bericht
news:44**********************@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" <Mo************@hotmail.comschreef in bericht
news:op***************@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 <ne**@hellobasic.com>
wrote:
>I can't find a way to obtain the months name from a date.
Like 'August'


--
Happy Coding!
Morten Wennevik [C# MVP]

Jul 31 '06 #5
"Edwin Knoppert" <ne**@hellobasic.comwrote in message
news:44**********************@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");
Jul 31 '06 #6
Hah!
Before i tried M and MM but failed :)
"Mark Rae" <ma**@markNOSPAMrae.comschreef in bericht
news:e2*************@TK2MSFTNGP06.phx.gbl...
"Edwin Knoppert" <ne**@hellobasic.comwrote in message
news:44**********************@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");

Jul 31 '06 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: wolftor | last post by:
Month(date) shows the month number. Is there a way to get the month name ie. October? -- Regards, Peter
3
by: wolftor | last post by:
Month(date) shows the month number. Is there a way to get the month name ie. October? -- Regards, Peter
1
by: Finlay | last post by:
Hi Group I am designing a report that should show a meter reading for each month and the previous meter reading for the previous month. The months are text stored in a field tMonth. The...
6
by: Ante Perkovic | last post by:
Hi, How to declare datetime object and set it to my birthday, first or last day of this month or any other date. I can't find any examples in VS.NET help! BTW, what is the difference...
7
by: Novice Computer User | last post by:
Hi. Can somebody PLEASE help. I have spent hours on this.. but I am a total novice and can't seem to figure it out. Here is a .php script. Right now, the minimum amount of time (i.e. duration)...
10
by: cover | last post by:
I can get the current month to display in a text box by inserting value="<? print strftime("%B"); ?>"> into the code for that particular text box on a form but how can I populate a drop down with...
22
by: Stan | last post by:
I am working with Access 2003 on a computer running XP. I am new at using Access. I have a Db with a date field stored as mm/dd/yyyy. I need a Query that will prompt for the month, ie. 6 for...
7
by: ajaydesai | last post by:
I have JavaScript code to dispaly two month calendar days at a time, but i have a problem both month that disaplay at a time have same days (for example May and June has same days, June and July have...
5
by: wugon.net | last post by:
question: db2 LUW V8 UNION ALL with table function month() have bad query performance Env: db2 LUW V8 + FP14 Problem : We have history data from 2005/01/01 ~ 2007/05/xx in single big...
12
by: Be Borth | last post by:
I saw previous solutions to convert a month number (1) to a month name (January). I have a database with 200+ dates. In a query, I use the "Part" function DatePart("m",), to extract the month...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.