Client time when using now() RRS feed

  • Question

  • All:

    I am developing a browser-enabled form and need to get the time on the client PC instead of the time on the server.  The now() function returns the server time.  I cannot hard-code an offset as this form will be deployed globally.

    Any help would be appreciated.

    Thanks in advance


    Monday, March 28, 2011 5:15 PM

All replies

  • Hi Ed,

    You have to do that with Javascript, and via a Jquery script you can add the value to a field:

    <script language="javascript">
    function GetClientTime()
    var now = new Date()
    var offset = now.getTimezoneOffset();
    document.Form1.hdClientUTC.value = offset

    Regards, Marijn Somers|| SharePoint Consultant- MCTS SharePoint 2007, 2010 configuring http://www.beyond-it.be || Twitter: http://twitter.com/marijnsomers || http://marijnsomers.blogspot.com
    Friday, April 15, 2011 6:45 AM