how to us Microsoft.VisualBasic.DateAndTime.MonthName

  • Thread starter Thread starter Abraham Andres Luna
  • Start date Start date
A

Abraham Andres Luna

how can i use the DateAndTime module in my csharp code

i included a using statement:

using Microsoft.VisualBasic;

and then called the function:

DateAndTime.MonthName(1);

but i keep getting a "The name 'DateAndTime' does not exist in the current
context" error

thank you for your help
 
Abraham said:
i included a using statement:

using Microsoft.VisualBasic;

A using statement by itself, is not enough. You need to set a
reference to the Visual Basic assembly (.dll) as well.

If you have a DateTime variable, you can get the full month name from
that as per this example:

Dim dt As DateTime = DateTime.Now
MsgBox(dt.ToString("MMMM"))
 
Hi,

You do not need to use VB for this, DateTime.ToString() has an overloaded
version that accept a DateTimeFormatInfo that do just that.

For your case you could use MMM for the abreviated name or MMMM for the
fullname

cheers,
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top