how do i convert a date from the format mmddyyhhmiss to yyyymmdd-hh24miss-very urgent

how do i convert a date from the format mmddyyhhmiss to yyyymmdd-hh24miss-very urgent
amuktaAsked:
Who is Participating?
 
AlexNekConnect With a Mentor Commented:
Parse string to DateTime first and then format how you need
0
 
AlexNekCommented:
Something like
//mmddyyhhmin
string dateString = "031820070915";
IFormatProvider culture = new CultureInfo("en-US", true);
DateTime dt = DateTime.ParseExact(dateString, "MMddyyhhmm", culture);
Console.WriteLine(dt);

//yyyymmdd-hh24min
Console.WriteLine(dt.ToString("yyyMMdd-HHmm"));

0
 
amuktaAuthor Commented:
Thank you very much.It helped me a lot
0
Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

 
amuktaAuthor Commented:
Thank you very much
0
 
amuktaAuthor Commented:
THnak you very much
0
 
AlexNekCommented:
You are welcome. Thank you too.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.