Linked Questions
16 questions linked to/from How to parse a month name (string) to an integer for comparison in C#?
7
votes
3answers
18k views
C# Get Month INT from Month String [duplicate]
I found a lot of ways to get the name from a number but now I need it the other way around.
If the string equals April, I want to convert it to int "4".
Does anyone know the best way to accomplish ...
1
vote
2answers
4k views
Convert month string to int format [duplicate]
I have the following string "Dec".
How can I convert this string to the month number 12?
I tried this:
DateTime.ParseExact("Dec", "MMMM", null).Month
This doesn't work.
1
vote
1answer
709 views
How to convert in c# date if date month is text [duplicate]
Best way of converting date like "December 6, 2011" to pattern like "yyyy-MM-dd" ?
8
votes
3answers
18k views
Convert a string containing monthName to Int of MonthDigit
I have a string which has short month name in it.\
string month = "Jun";
I need to get month in digit from this month name.
Say i do this:
int monthInDigit = getMonth(month);
monthInDigit <-- ...
3
votes
4answers
23k views
How to display month number on selecting month name
I have a list of Months displayed in a drop down. On selecting a particular month I would like to display the number of the month in a text box.
For example if I select January I would like to ...
4
votes
4answers
2k views
how to get the days for particular month and year
I have a method which passes two parameters Month and year
i will call this Method like this : MonthDates(January,2010)
public static string MonthDates(string MonthName,string YearName)
{
...
2
votes
9answers
13k views
How to get short month name from full month name?
I need to get the short month name for the full month name.
For example,
DateTime.Now.ToString("MMMM", CultureInfo.CurrentCulture);
this returns - "agosto"
DateTime.Now.ToString("MMM", CultureInfo....
5
votes
5answers
554 views
How to return the number of a month in C# function
I want to return the number of a month and i made a function but it always returns 0
this is my code:
public int getNrMonth(String s)
{
int nr=0;
if (s.Equals("January"))
...
0
votes
2answers
155 views
C# transform string to date yyyy-MMM
I need transform this input string june 2014 in 2014-06 output date and I tried this solution:
DateTime dt;
DateTime.TryParseExact(Input.ToString(), "MMM yyyy",
CultureInfo....
0
votes
1answer
1k views
convert date format MMMM yyyy to yyyyMM in asp.net vb
i have textbox that contain string month and year value, example: January 2010
but i want to save it into mysql database with format 201001 --->year and then number of month
how can i convert this ...
1
vote
4answers
987 views
How do I convert month names to int?
I have a column called Month in a stored proc which returns to me the month in string name terms (eg. January, Febuary, March etc.)
I would like to convert that to an integer.
Is that possible ...
-1
votes
2answers
109 views
Converting string with month that is not integer to datetime [duplicate]
I have strings in the format
Mar 25 2013 6:30PM
and I want to convert them to datetime objects in the format
2013-03-25 18:30:00
how would I go about doing this?
0
votes
2answers
91 views
How to fix the following code so that it is ordered?
I am creating an application with MVC 4. The code requires that it goes and gets data for individuals for each month. I have written the code so that it does that.
But the month is not ordered. The ...
-3
votes
1answer
67 views
Library for translating months into integers C# .NET
I am trying to turn a month name string into an integer. From my form I am getting a string value for the month, "march" or "april". I was wondering if there was a way of using a library in order to ...
0
votes
1answer
65 views
Is it possible to validate a column based on a column name?
I have an excel validation program that imports excel files and places the values on a DataGridView. I want to validate columns January to December which I already did but I want to validate them by ...