Search code examples
weblotus-noteslotus-dominolotusscriptlotus-formula

Use Local Time zone in Web Lotus Notes Application


Is there a way to make the time (local) being used by the web based lotus notes application. I noticed that in notes client that basically it always uses the right time of the local machine so it doesn't confuse the users. Wherever he/she is in the world.

The problem is happening in the web, it uses the server machine time thus confusing the user. For example a user created a new document the time it would display or use in the web is the server machine. How can I use or convert it to local machine or local time zone.

The formula I used is just @Now, I already looked in the internet for solution but I did not find what I need or maybe didn't noticed them so if you have links please share it here and if you know how then do guide me. I saw a solution but it's not efficient, it requires changing the web browser options thus it requires to be set up in every computer. I would like to implement it in codes thus the users would not do anything.

Is there a formula in getting the timezone of the local machine? @GetCurrentTimeZone which still gets the timezone of the server.


Solution

  • I would use Javascript in the browser to detect the local timezone and adjust the time accordingly.

    Updated: Take a look at this blog entry: http://blog.texasswede.com/replace-images-on-web-page-using-jquery/

    I would suggest that you do something similar. Put a span around the time (make sure you have the time as GMT/UTC) with a specific class that makes it easy for you to get all the instances of a time you need to change. You want the HTML to look something like this:

    <span class="GMTtime">7/8/2014 1:23:45 PM UTC</span>
    

    Then you write some Javascript/jQuery code that will execute after the page is loaded (like in the example linked above). Something like this (not tested):

    $(".GMTtime").each( function() {
        var gmttime = $(this).html(); // Get GMT time value
        var d = new Date(gmttime); // Create date object
        // Get local time and remove TZ offset at end
        var localtime = d.toString().replace(/GMT.*/g,""); 
        $(this).html(localtime);      // Replace GMT value with local value in HTML
    });