In the words of Sallah -- bad dates
-
Some date routines I found swept under the rug. How they got into the code-base I don't know, but there was only one C# developer on the project when I joined, so I waited until he left.
// Return a string to display a DateTime object
// as DTZ: YYYYMMDDTHHMMSSZ = 20110101T070000Z
public static string GetDTZ(DateTime inDT)
{
string rString = "";rString += inDT.Year;
rString += FixDigits(inDT.Month, 2);
rString += FixDigits(inDT.Day, 2);
rString += "T";
rString += FixDigits(inDT.Hour, 2);
rString += FixDigits(inDT.Minute, 2);
rString += FixDigits(inDT.Second, 2);
rString += "Z";return rString;
}// end GetDTZ// Return the name of the month that corresponds to a digit 1-12
public static string GetMonthName(int inMonth)
{
string[] months = { "", "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December" };
return months[inMonth % 13];
}// endGetMonthName// Return a text version of an integer from 1-99
public static string GetDateName(int inNumber)
{
string[] nos = {"", "first", "second", "third", "fourth", "fifth", "sixth", "seventh", "eighth", "nineth",
"tenth", "eleventh", "twelfth", "thirteeth", "fourteenth", "fifteenth", "sixteenth", "seventeenth", "eighteenth", "nineteenth",
"twenty", "twenty first", "twenty second", "twenty third", "twenty fourth", "twenty fifth", "twenty sixth", "twenty seventh", "twenty eigth", "twenty ninth",
"thirty", "thirty first", "thirty second", "thirty third", "thirty fourth", "thirty fifth", "thirty sixth", "thirty seventh", "thirty eigth", "thirty ninth",
"forty", "forty first", "forty second", "forty third", "forty fourth", "forty fifth", "forty sixth", "forty seventh", "forty eigth", "forty ninth",
"fi -
Some date routines I found swept under the rug. How they got into the code-base I don't know, but there was only one C# developer on the project when I joined, so I waited until he left.
// Return a string to display a DateTime object
// as DTZ: YYYYMMDDTHHMMSSZ = 20110101T070000Z
public static string GetDTZ(DateTime inDT)
{
string rString = "";rString += inDT.Year;
rString += FixDigits(inDT.Month, 2);
rString += FixDigits(inDT.Day, 2);
rString += "T";
rString += FixDigits(inDT.Hour, 2);
rString += FixDigits(inDT.Minute, 2);
rString += FixDigits(inDT.Second, 2);
rString += "Z";return rString;
}// end GetDTZ// Return the name of the month that corresponds to a digit 1-12
public static string GetMonthName(int inMonth)
{
string[] months = { "", "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December" };
return months[inMonth % 13];
}// endGetMonthName// Return a text version of an integer from 1-99
public static string GetDateName(int inNumber)
{
string[] nos = {"", "first", "second", "third", "fourth", "fifth", "sixth", "seventh", "eighth", "nineth",
"tenth", "eleventh", "twelfth", "thirteeth", "fourteenth", "fifteenth", "sixteenth", "seventeenth", "eighteenth", "nineteenth",
"twenty", "twenty first", "twenty second", "twenty third", "twenty fourth", "twenty fifth", "twenty sixth", "twenty seventh", "twenty eigth", "twenty ninth",
"thirty", "thirty first", "thirty second", "thirty third", "thirty fourth", "thirty fifth", "thirty sixth", "thirty seventh", "thirty eigth", "thirty ninth",
"forty", "forty first", "forty second", "forty third", "forty fourth", "forty fifth", "forty sixth", "forty seventh", "forty eigth", "forty ninth",
"fistring[] days = {"", "1st", "2nd", "3rd", "4th", "5th", "6th", "7th", "8th", "9th", "10th", "11th", "12th", "13th", "14th", "15th", "16th",
"17th", "18th", "19th", "20th", "21th", "22nd", "23rd", "24th", "25th", "26th", "27th", "28th", "29th", "30th", "31st", "32nd"};32nd day? But how? :confused:
-
string[] days = {"", "1st", "2nd", "3rd", "4th", "5th", "6th", "7th", "8th", "9th", "10th", "11th", "12th", "13th", "14th", "15th", "16th",
"17th", "18th", "19th", "20th", "21th", "22nd", "23rd", "24th", "25th", "26th", "27th", "28th", "29th", "30th", "31st", "32nd"};32nd day? But how? :confused:
How 'bout "21th" ?
-
string[] days = {"", "1st", "2nd", "3rd", "4th", "5th", "6th", "7th", "8th", "9th", "10th", "11th", "12th", "13th", "14th", "15th", "16th",
"17th", "18th", "19th", "20th", "21th", "22nd", "23rd", "24th", "25th", "26th", "27th", "28th", "29th", "30th", "31st", "32nd"};32nd day? But how? :confused:
Room for future extensions...
I'm not questioning your powers of observation; I'm merely remarking upon the paradox of asking a masked man who he is. (V) תפסיק לספר לה' כמה הצרות שלך גדולות, תספר לצרות שלך כמה ה' גדול!
-
Some date routines I found swept under the rug. How they got into the code-base I don't know, but there was only one C# developer on the project when I joined, so I waited until he left.
// Return a string to display a DateTime object
// as DTZ: YYYYMMDDTHHMMSSZ = 20110101T070000Z
public static string GetDTZ(DateTime inDT)
{
string rString = "";rString += inDT.Year;
rString += FixDigits(inDT.Month, 2);
rString += FixDigits(inDT.Day, 2);
rString += "T";
rString += FixDigits(inDT.Hour, 2);
rString += FixDigits(inDT.Minute, 2);
rString += FixDigits(inDT.Second, 2);
rString += "Z";return rString;
}// end GetDTZ// Return the name of the month that corresponds to a digit 1-12
public static string GetMonthName(int inMonth)
{
string[] months = { "", "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December" };
return months[inMonth % 13];
}// endGetMonthName// Return a text version of an integer from 1-99
public static string GetDateName(int inNumber)
{
string[] nos = {"", "first", "second", "third", "fourth", "fifth", "sixth", "seventh", "eighth", "nineth",
"tenth", "eleventh", "twelfth", "thirteeth", "fourteenth", "fifteenth", "sixteenth", "seventeenth", "eighteenth", "nineteenth",
"twenty", "twenty first", "twenty second", "twenty third", "twenty fourth", "twenty fifth", "twenty sixth", "twenty seventh", "twenty eigth", "twenty ninth",
"thirty", "thirty first", "thirty second", "thirty third", "thirty fourth", "thirty fifth", "thirty sixth", "thirty seventh", "thirty eigth", "thirty ninth",
"forty", "forty first", "forty second", "forty third", "forty fourth", "forty fifth", "forty sixth", "forty seventh", "forty eigth", "forty ninth",
"fi:doh: I will be blunt about this: that guy was an idiot.
What do you get when you cross a joke with a rhetorical question? --- The metaphorical solid rear-end expulsions have impacted the metaphorical motorized bladed rotating air movement mechanism.
-
string[] days = {"", "1st", "2nd", "3rd", "4th", "5th", "6th", "7th", "8th", "9th", "10th", "11th", "12th", "13th", "14th", "15th", "16th",
"17th", "18th", "19th", "20th", "21th", "22nd", "23rd", "24th", "25th", "26th", "27th", "28th", "29th", "30th", "31st", "32nd"};32nd day? But how? :confused: