Created
August 24, 2011 20:58
-
-
Save ryanatwork/1169216 to your computer and use it in GitHub Desktop.
ParseDates
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
protected string ParseDate(DateTime startDate, DateTime endDate) | |
{ | |
string temp; | |
//Don't show times if 12:00 AM | |
bool showStartTime = false; | |
bool showEndTime = false; | |
if (DateTime.Parse(startDate.ToShortTimeString()) != DateTime.Parse("12:00 AM")) | |
{ | |
showStartTime = true; | |
if (DateTime.Parse(endDate.ToShortTimeString()) != DateTime.Parse("12:00 AM")) | |
showEndTime = true; | |
} | |
if (startDate.Date == endDate.Date) | |
{ | |
temp = startDate.ToString("dddd, MMM.dd"); | |
/* if (startDate.ToShortTimeString() != endDate.ToShortTimeString()) | |
{ | |
if (showStartTime) | |
{ | |
temp += " | " + startDate.ToShortTimeString(); | |
if (showEndTime) | |
temp += (" - " + endDate.ToShortTimeString()); | |
} | |
}*/ | |
} | |
else | |
{ | |
temp = startDate.ToString("dddd, MMM.dd"); | |
//if (showStartTime) | |
// temp += " " + startDate.ToShortTimeString(); | |
//temp += (" - " + endDate.ToString("dddd, MMM.dd"); | |
//if (showEndTime) | |
// temp += " " + endDate.ToShortTimeString(); | |
} | |
return temp; | |
} | |
protected string ParseMonth(DateTime startDate) | |
{ | |
//Added for Homepage 1/21/2010 - RR | |
string temp; | |
temp = startDate.ToString("MMM"); | |
return temp; | |
} | |
protected string ParseDay(DateTime startDate) | |
{ | |
//Added for Homepage 1/21/2010 - RR | |
string temp; | |
temp = startDate.ToString("dd"); | |
return temp; | |
} |
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
protected string ParseDate(DateTime startDate, DateTime endDate) | |
{ | |
string temp; | |
//Don't show times if 12:00 AM | |
bool showStartTime = false; | |
bool showEndTime = false; | |
if (DateTime.Parse(startDate.ToShortTimeString()) != DateTime.Parse("12:00 AM")) | |
{ | |
showStartTime = true; | |
if (DateTime.Parse(endDate.ToShortTimeString()) != DateTime.Parse("12:00 AM")) | |
showEndTime = true; | |
} | |
if (startDate.Date == endDate.Date) | |
{ | |
//temp = startDate.ToShortDateString(); | |
//Modified 1/21/2010 -RR | |
temp = startDate.ToString("MMM dd, yyyy"); | |
if (startDate.ToShortTimeString() != endDate.ToShortTimeString()) | |
{ | |
if (showStartTime) | |
{ | |
temp += " " + startDate.ToShortTimeString(); | |
if (showEndTime) | |
temp += (" - " + endDate.ToShortTimeString()); | |
} | |
} | |
} | |
else | |
{ | |
//temp = startDate.ToShortDateString(); | |
//Modified 1/21/2010 -RR | |
temp = startDate.ToString("MMM dd, yyyy"); | |
//if (showStartTime) | |
//temp += " " + startDate.ToShortTimeString(); | |
temp += (" - " + endDate.ToShortDateString()); | |
//if (showEndTime) | |
//temp += " " + endDate.ToShortTimeString(); | |
} | |
return temp; | |
} | |
protected string ParseMonth(DateTime startDate) | |
{ | |
//Added for Homepage 1/21/2010 - RR | |
string temp; | |
temp = startDate.ToString("MMM"); | |
return temp; | |
} | |
protected string ParseDay(DateTime startDate) | |
{ | |
//Added for Homepage 1/21/2010 - RR | |
string temp; | |
temp = startDate.ToString("dd"); | |
return temp; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment