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
alpha tran
NA
4
0
Problem to convert string to DateTime
May 19 2009 12:27 PM
When I try to convert a string to DateTime, I got this problem:
private void button1_Click(object sender, EventArgs e)
{
string st = "05/19/2009";
DateTime dt = Convert.ToDateTime(st, CultureInfo.InvariantCulture ); //result is: {5/19/2009 12:00:00 MO}
string st2 = Convert.ToString(dt, CultureInfo.InvariantCulture ); //reult is: "05/19/2009 00:00:00"
}
MO: is the custom AMDesignator I set in Control Panel, I need it to be "AM" as the AMdesignator of InvariantCulture.DateTimeFormat
So we can say that CultureInfo.InvariantCulture did not effect on the conversion from string to DateTime
.... but in reverse conversion (the second conversion above) it worked ok
by reading many many pages over the internet with many way but no arcticle could help me.
How can I solve this by C# code?
Reply
Answers (
0
)
[.NET MSIL - HELP] Rebuilding Pointer-Based Instructions
Need help to start sc.exe from c# and pass parms in quotes