Add Time/Date to Layouts or Master Page


To add this web control to your master page do the following:
  1. Add in the following registration to the top of the master page:
    <%@ Register Tagprefix="SPSWC" Namespace="Microsoft.SharePoint.Portal.WebControls" Assembly="Microsoft.SharePoint.Portal, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
  2. Add in the the following code right below the welcome control “IdWelcome” DIV in your master page.

       
         
  3. Then add in some quick styles to your custom style sheet so that the time is set to white. .currenttime{
        color: #FFF;
        text-align: right;
        font-family: Arial, sans-serif;
        font-weight: normal;
        font-size: 12px;
    }
Your site should look something like this:
image

Notice the time below the users name. Now if the logged in user changes the time zone in their profile it will automatically update the time on all the pages that use this master page.
image

Comments

Popular posts from this blog

SharePoint: Group By on more than 2 columns in a view (SP 2010)

Configure Form Based Authentication (FBA) in SharePoint 2010

SharePoint 2010 Windows PowerShell Interview Questions