Anonymous
Domino 2.0 Rich Internet Applications with IBM Lotus Notes/Domino
You are here: Today » @Formula to generate a valid RFC822 date-time
« In search for the fastest string concatenation method in LotusScript
Tree component: the Domino side »

@Formula to generate a valid RFC822 date-time

I used the W3C Feed Validation Service to validate the RSS feed with the computed date. The format is explained in the help. Very weird: I coudn't find an existing Notes formula solution to do that anywhere on the Internet. So finally I had a go at it myself.

The formula

Here's the formula I came up with:

a:=@Now;

d:=@Right("0"+@Text(@day(a)); 2);
m:=@Word("Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec"; " "; @Month(a));
y:=@Text(@Year(a));
tm:=@Right("0"+@Text(@hour(a)); 2)+":"+@Right("0"+@Text(@minute(a)); 2);
tz:=@ReplaceSubstring(@TimeZoneToText(@GetCurrentTimeZone; "S"); "GMT":":"; "");

@Implode(d:m:y:tm:tz; " ")

Which gives me something like:

03 Jan 2008 23:05 +0100

Star rating

0%

Comments

  1. 04.01.2008 08:41:22, Fabian Robok

    It seems like Domino takes care of the conversion automatically in some contexts. When I played around with setting expires headers, I started off writing my own formula to generate an RFC822 date-time. Not as elegant as yours, btw., especially the month selection is so sweet and simple. But after some testing it appeared, that @SetHttpHeader (or something in the Domino engine) is obviously smart enough, to output the date in the correct format, when fed with a regular Notes date.

    Of course, this does not happen everywhere, so this is still pretty useful. Even better would be @Time(time-date; ), though.

  2. 04.01.2008 08:43:13, Fabian Robok

    Oops, the "hyperlink" in my previous comment was meant to be (sqare bracket open)RFC822(square bracket close).

  3. 01/04/2008 07:45:18 PM, Tom ONeil

    Take a look at this: http://www.grange.com.br/display-tech_tip.php?138

    I stole the Lotusscript version a long time ago and it worked like a charm.

To add a comment, log in or register as new user. It's free and safe.