Removing the 12:00 timestamp from Calendar View

Occasionally, you have a calendar full of all-day events and you don't want the calendar cluttered up with redundant timestamps.  Here's a simple client-side script, suitable for framing (or a master page, or a content editor web part) that will cut down on the visual noise.

<script language="JavaScript">
var allDates = document.getElementsByTagName("nobr");
for(var i=0;i 0) {
      allDates[i].innerHTML = allDates[i].innerHTML.replace("12:00 AM","");
    }
  }
</script>

4 Comments

  • While this would certainly strip that out, why not just put the value you want in your textbox/label to start?

    // Display using current (en-us) culture's short date format

    DateTime thisDate = new DateTime(2008, 3, 15);

    Console.WriteLine(thisDate.ToString("d")); &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // Displays 3/15/2008

  • Hi Russell,

    Thanks for weighing in. You're right about correct server-side output being preferable; however, the vast majority of SharePoint users aren't going to have programmatic access to the Calendar API, and even if they do, it's a hefty task to change the way it spits out data. This can be done by a power user with the browser UI in about a minute.

  • I cant get this to work. I want to remove the time stam from a Date and Time field on the Display form of a custom list.

  • &quot;This can be done by a power user with the browser UI in about a minute.&quot;

    I created a calendar view for an activities list. &nbsp;The monthly view shows the 12:00am - 12:00am line which is useless, takes precious space, and is misinforming. &nbsp;I would love to implement your solution but not sure how based on your comment. &nbsp;I don't have access to Designer.

    Would appreciate if you could explain how to implement the code via the browser UI (and save it to the view)

    Thanks!

Comments have been disabled for this content.