Getting an ISO8601 formatted Date using Domino @Formula
Category ISO8601 @Formula
I recently had a need to show a domino view column in ISO 8601 date/time format. I was really hoping that as Notes uses this format in many of it's representations in Notes XML views that there would be something like a simple @TEXT option, sadly there isn't. I wouldn't recommend using this in a view column directly, put a computed text field in your document that stores it, and refer to that in your view column.
So here's the formula that will return a date in UTC (zulu) time, assuming I want to use the Created date for the document
TimetoConvert := @Created;
DocTime := @TIMEMERGE(TimetoConvert ;TimetoConvert ;"Z=0$DO=1$DL=3 -1 1 10 -1 1$ZX=36$ZN=GMT");
Year:= @Text (@Year(DocTime));
Month := @If(@Month(DocTime) < 10;"0";"") + @Text(@Month(DocTime));
Day := @If(@Day(DocTime) < 10;"0";"") + @Text(@Day(DocTime));
Hours := @If(@Hour(DocTime) < 10;"0";"") + @Text(@Hour(DocTime));
Minutes := @If(@Minute(DocTime) < 10;"0";"") + @Text(@Minute(DocTime));
Seconds := @If(@Second(DocTime) < 10;"0";"") + @Text(@Second(DocTime));
Year + "-" + Month + "-" + Day +"T" +Hours + ":" + Minutes + ":" + Seconds + "Z"
If you're wondering what "Z=0$DO=1$DL=3 -1 1 10 -1 1$ZX=36$ZN=GMT" actually means, it's basically the Domino Time Zone code for GMT with no Daylight savings, aka Universal Time(zulu time). Anyway you'll have to continue to wonder what the format means exactly, to quote one of the best lines in an IBM support document ever.
How about someone documents the parameters? It must be on an internal IBM spec that defined this function when they wrote it, surely someone could document it for the public?
I hear Domino 8.5 is much better at this with XPages, but I can't run my server on Domino 8.5 until a supported Sametime version is shipped.
I recently had a need to show a domino view column in ISO 8601 date/time format. I was really hoping that as Notes uses this format in many of it's representations in Notes XML views that there would be something like a simple @TEXT option, sadly there isn't. I wouldn't recommend using this in a view column directly, put a computed text field in your document that stores it, and refer to that in your view column.
So here's the formula that will return a date in UTC (zulu) time, assuming I want to use the Created date for the document
TimetoConvert := @Created;
DocTime := @TIMEMERGE(TimetoConvert ;TimetoConvert ;"Z=0$DO=1$DL=3 -1 1 10 -1 1$ZX=36$ZN=GMT");
Year:= @Text (@Year(DocTime));
Month := @If(@Month(DocTime) < 10;"0";"") + @Text(@Month(DocTime));
Day := @If(@Day(DocTime) < 10;"0";"") + @Text(@Day(DocTime));
Hours := @If(@Hour(DocTime) < 10;"0";"") + @Text(@Hour(DocTime));
Minutes := @If(@Minute(DocTime) < 10;"0";"") + @Text(@Minute(DocTime));
Seconds := @If(@Second(DocTime) < 10;"0";"") + @Text(@Second(DocTime));
Year + "-" + Month + "-" + Day +"T" +Hours + ":" + Minutes + ":" + Seconds + "Z"
If you're wondering what "Z=0$DO=1$DL=3 -1 1 10 -1 1$ZX=36$ZN=GMT" actually means, it's basically the Domino Time Zone code for GMT with no Daylight savings, aka Universal Time(zulu time). Anyway you'll have to continue to wonder what the format means exactly, to quote one of the best lines in an IBM support document ever.
he third parameter of the method contains a lengthy text string which represents the relative time zone (for example the string for Easter Daylight Time is "Z=5$DO=1$DL=4 1 1 10 -1 1$ZX=25$ZN=Eastern"). There is no documentation on these parameters, and in order to determine the correct string for the time zone you would like to use it is suggested that you create a sample form with a field with the type 'Timezone'.
How about someone documents the parameters? It must be on an internal IBM spec that defined this function when they wrote it, surely someone could document it for the public?
I hear Domino 8.5 is much better at this with XPages, but I can't run my server on Domino 8.5 until a supported Sametime version is shipped.
Comments
Posted by Glen At 02:27:13 PM On 11/18/2008 | - Website - |
Posted by Turtle At 12:09:52 PM On 11/19/2008 | - Website - |
{ Link }
Posted by James Sjostedt At 04:04:13 PM On 11/19/2008 | - Website - |
Good to see someone had the foresight to post it.
Thanks James!
Posted by Carl Tyler At 04:09:35 PM On 11/19/2008 | - Website - |
Posted by Mke Mortin At 10:02:03 AM On 11/20/2008 | - Website - |
Posted by Edwin At 03:36:55 AM On 03/13/2009 | - Website - |