Random observations of a very experienced software artist.

    Creating an ISO Date in Lotus Notes Formula Language

    John McCann  July 21 2010 06:00:00 PM
    Another posting on the lack of ISO 8601 support in Lotus Domino.  

    I had a value in a date variable and had to display it on the web in a locale and timezone independent format.   Dojo has been chosen as the tool to use, so I was trying to display the data using Dojo.   My fun was finding out how to get Lotus to display the date time using ISO standards.  While I can display yyyy-mm-dd for a date only variable, forget the yyyy-mm-ddThh:mm:ssTZ needed for date time.   Oh, and I need to display the UTC, GMT, or Zulu time (all the same, just different names).

    My solution is to use a computed for display field or computed text and the following (for field XYZZY):

    $txtTime := @If(@IsTime(XYZZY);@Explode(@TimeToTextInZone(XYZZY;"Z=0$DO=0";"D0T1S2");" /:");"");

    @If(        $txtTime="";

                    "";

            @Elements($txtTime)<6;"";

                    $txtTime[3] + "-" +  $txtTime[1] + "-" + $txtTime[2] + "T" +

                    @If($txtTime[6]="PM"; @Text(@TextToNumber($txtTime[4])+12); $txtTime[4]) + ":" + $txtTime[5] + "Z"

            )

    There is a little more to get dojo to display it in the browser's locale and timezone, but this at least gets the value out of Domino in the proper format.