Skip to content

Instantly share code, notes, and snippets.

@nishanc
Created December 12, 2021 13:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nishanc/2a2badef31c386ef2bd8d44508a2945b to your computer and use it in GitHub Desktop.
Save nishanc/2a2badef31c386ef2bd8d44508a2945b to your computer and use it in GitHub Desktop.
public DateTime ConvertToDateTime()
{
private static readonly string _dateString = "01 05 1991";
var day = _dateString.Substring(0, 2);
var month = _dateString.Substring(3, 2);
var year = _dateString.Substring(6);
return new DateTime(int.Parse(year), int.Parse(month), int.Parse(day));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment