Guest User

Untitled

a guest
Jan 23rd, 2018
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.53 KB | None | 0 0
  1. protected string ParseDate(DateTime startDate, DateTime endDate)
  2. {
  3. string temp;
  4. //Don't show times if 12:00 AM
  5. bool showStartTime = false;
  6. bool showEndTime = false;
  7. if (DateTime.Parse(startDate.ToShortTimeString()) != DateTime.Parse("12:00 AM"))
  8. {
  9. showStartTime = true;
  10. if (DateTime.Parse(endDate.ToShortTimeString()) != DateTime.Parse("12:00 AM"))
  11. showEndTime = true;
  12. }
  13. if (startDate.Date == endDate.Date)
  14. {
  15. temp = startDate.ToString("dddd, MMM.dd");
  16. /* if (startDate.ToShortTimeString() != endDate.ToShortTimeString())
  17. {
  18. if (showStartTime)
  19. {
  20. temp += " | " + startDate.ToShortTimeString();
  21. if (showEndTime)
  22. temp += (" - " + endDate.ToShortTimeString());
  23. }
  24. }*/
  25. }
  26. else
  27. {
  28. temp = startDate.ToString("dddd, MMM.dd");
  29. //if (showStartTime)
  30. // temp += " " + startDate.ToShortTimeString();
  31. //temp += (" - " + endDate.ToString("dddd, MMM.dd");
  32. //if (showEndTime)
  33. // temp += " " + endDate.ToShortTimeString();
  34.  
  35. }
  36. return temp;
  37. }
  38.  
  39.  
  40. protected string ParseMonth(DateTime startDate)
  41. {
  42. //Added for Homepage 1/21/2010 - RR
  43.  
  44. string temp;
  45.  
  46.  
  47. temp = startDate.ToString("MMM");
  48.  
  49.  
  50. return temp;
  51. }
  52.  
  53. protected string ParseDay(DateTime startDate)
  54. {
  55. //Added for Homepage 1/21/2010 - RR
  56.  
  57. string temp;
  58.  
  59.  
  60. temp = startDate.ToString("dd");
  61.  
  62.  
  63. return temp;
  64. }
Add Comment
Please, Sign In to add comment