Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 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;
- }
Add Comment
Please, Sign In to add comment