-
-
Save anonymous/5b2aa276c07707fbe917 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
// date, make into DD MMM YY hh:mm to avoid US/UK data conversion | |
// split off the time | |
if (dataValue.IndexOf(' ') < 0 ) dataValue += " 00:00:00"; | |
string timePart = dataValue.Substring(dataValue.IndexOf(' ')).Trim(); | |
string datePart = dataValue.Substring(0, dataValue.IndexOf(' ')).Trim(); | |
// check if it has slash separator | |
if (datePart.Contains("/") && timePart.Contains(":")) | |
{ | |
string[] dateBits = datePart.Split('/'); | |
if (dateBits.GetUpperBound(0) == 2) | |
{ | |
string MonthName = (new DateTime(2007, int.Parse(dateBits[1]), 1)).ToString("MMM"); | |
if (IsDate(dateBits[0] + " " + MonthName + " " + dateBits[2])) | |
{ | |
_return = "'" + dateBits[0] + " " + MonthName + " " + dateBits[2] + " " + timePart + "'"; | |
} | |
else | |
{ | |
_return = "NULL"; | |
} | |
} | |
else | |
{ | |
_return = "NULL"; | |
} | |
} | |
else | |
{ | |
if (IsDate(dataValue)) _return = "'" + dataValue + "'"; else _return = "NULL"; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment