Guest User

Untitled

a guest
Jan 23rd, 2018
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.72 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.ToShortDateString();
  16. //Modified 1/21/2010 -RR
  17. temp = startDate.ToString("MMM dd, yyyy");
  18. if (startDate.ToShortTimeString() != endDate.ToShortTimeString())
  19. {
  20. if (showStartTime)
  21. {
  22. temp += " " + startDate.ToShortTimeString();
  23. if (showEndTime)
  24. temp += (" - " + endDate.ToShortTimeString());
  25. }
  26. }
  27. }
  28. else
  29. {
  30. //temp = startDate.ToShortDateString();
  31. //Modified 1/21/2010 -RR
  32. temp = startDate.ToString("MMM dd, yyyy");
  33. //if (showStartTime)
  34. //temp += " " + startDate.ToShortTimeString();
  35. temp += (" - " + endDate.ToShortDateString());
  36. //if (showEndTime)
  37. //temp += " " + endDate.ToShortTimeString();
  38.  
  39. }
  40. return temp;
  41. }
  42.  
  43. protected string ParseMonth(DateTime startDate)
  44. {
  45. //Added for Homepage 1/21/2010 - RR
  46.  
  47. string temp;
  48.  
  49.  
  50.  
  51. temp = startDate.ToString("MMM");
  52.  
  53.  
  54. return temp;
  55. }
  56.  
  57. protected string ParseDay(DateTime startDate)
  58. {
  59. //Added for Homepage 1/21/2010 - RR
  60.  
  61. string temp;
  62.  
  63.  
  64. temp = startDate.ToString("dd");
  65.  
  66.  
  67. return temp;
  68. }
Add Comment
Please, Sign In to add comment