TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Vuk Stanojevic
1.6k
140
44.8k
C# Convert month name to month number
May 2 2020 9:19 AM
Hi everyone,
i have combobox which i list of all 12 months.
I display there name of each month.
But for the code i must convert it to number.
When i try to convert it i get error "String was not recognized as valid DateTime".
Here is the code:
//Month name , for example January
string month = comboBox3.Text.Trim();
//Month number according to selected month in combobox3
int month1 = DateTime.ParseExact(month, "MMM",CultureInfo.CreateSpecificCulture("en-GB")).Month;
Can you help me?
Thank you.
Reply
Answers (
6
)
Configure vs2019 community ed. to use c# v8
program to make listbox and connect with database table