Created
June 22, 2020 17:44
-
-
Save glennlopez/e17ca2504061d2c71aebbf527d8e35b4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// <summary> | |
/// Datestamp_demo | |
/// </summary> | |
/// <returns>formatted date as per user configuration</returns> | |
public static string formatedDate(string usrFormat) | |
{ | |
StringBuilder simplifiedDateFormat = new StringBuilder(""); | |
// simplify date formatting usrFormat | |
int index = 0; | |
foreach (char letter in usrFormat) | |
{ | |
if (letter == 'm') | |
{ | |
simplifiedDateFormat.Append(Char.ToUpper(letter)); | |
index++; | |
} | |
else | |
{ | |
simplifiedDateFormat.Append(letter); | |
index++; | |
} | |
} | |
return DateTime.UtcNow.ToString(simplifiedDateFormat.ToString());; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment