Shivi
Shivi

Reputation: 1085

Datetime format Convert

I want to convert below format in DateTime. I want to convert it to datetime

"08-22T03:32"

Upvotes: 1

Views: 127

Answers (2)

Antonio Bakula
Antonio Bakula

Reputation: 20693

Since you don't have year in your date string, default will be current year, something like this :

DateTime dt = DateTime.ParseExact(dateString, "MM-ddTHH:mm", CultureInfo.InvariantCulture);

Upvotes: 5

pleinolijf
pleinolijf

Reputation: 911

If the string is formatted correctly, DateTime.Parse() is what you're looking for. But I think the 'date' part of that string is incomplete for it to work.

Upvotes: 0

Related Questions