0

A requirement has been issued to display the current server Date and time under the username on the right left corner of the SharePoint application. Can anyone advice on how I can do this ?

Thanks

EDIT

i added the following currentdate Div tag to my master page below the welcome div:-

<div id="suiteBarRight">
<SharePoint:AjaxDelta runat="server" id="DeltaSuiteBarRight" CssClass="ms-core-deltaSuiteBarRight" BlockElement="true">
<div id="welcomeMenuBox">
<wssuc:Welcome id="IdWelcome" runat="server" EnableViewState="false" />
  <div id="currentdate"></div>

Then i added a Script editor web part to my page as follow:-

<script type= "text/javascript">
document.getElementById("currentdate").innerHTML = formatAMPM();

function formatAMPM() {
var date = new Date();
var hours = date.getHours();
var days = date.getDay(); 
var minutes = date.getMinutes();
var ampm = hours >= 12 ? 'pm' : 'am';
hours = hours % 12;
hours = hours ? hours : 12; // the hour '0' should be '12'
minutes = minutes < 10 ? '0'+minutes : minutes;
var strTime = date ;
return strTime;
}
</script>

but the result is that the date will be shown very close to the user name on IE as follow:-

enter image description here

while it will be out of the layout on Firefox as follow:-

enter image description here

any idea how i can improve the layout for the date?

thanks

  • You do know that this will display the client date, not the server date, right? – Dave Wise Aug 30 '13 at 17:35
1

What do you mean by Server Data? and Why would you need the time below the user's info!

  • sorry i mean the server date not data ! i need to display the current date and time below the login username. can you check my update and what i have tried so far. – john Gu Aug 30 '13 at 16:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.