LS Date Format Inconsistencies on Server

I have a multi-value date field in my application called ReserveDates and a view of documents categorised by:(@Today - ReserveDates) / 86400 which gives me a view showing the number of days that have passed since the date(s) in the field.

This view works fine ON ALL MY SERVERS. Today it’s October 9th 2006 and (for example) if a document has a value of 5/10/2006 I see 4 in the column and so on. No problem so far.

If I look at the documents using Document Properties in the client the ReserveDates field looks fine too i.e it shows something like this:

05/10/2006 00:00:00 GDT

05/10/2006 00:00:00 GDT

Again, this is working as expected on ALL my servers.

When things start to go wrong is when I run a LotusScript agent on these documents and examine the dates.

The code I am running is this (I have missed out some of the unimportant code to keep this brief)

Dim todayDateTime As New NotesDateTime(Today)

Set doc = collection.GetFirstDocument

While Not doc Is Nothing

Forall d In doc.ReserveDates

Msgbox d

Set rDate = New NotesDateTime(d)

Msgbox rDate.DateOnly

diff = todayDateTime.TimeDifference(rDate) / 86400

Msgbox diff

End Forall

Set doc = collection.GetNextDocument(doc)

Wend

On my Windows XP Test Server (Running R6.5) everthing is fine - I get the exact results I would expect i.e something like

09/10/2006 09:09:57 AMgr: Agent (‘Date Testing’ in ‘Test.nsf’) message box: 05/10/2006

09/10/2006 09:09:57 AMgr: Agent (‘Date Testing’ in ‘Test.nsf’) message box: 05/10/2006

09/10/2006 09:09:57 AMgr: Agent (‘Date Testing’ in ‘Test.nsf’) message box: 4

However, on my Production Server (Windows 2003, Running Notes R7), even though THE VIEW WORKS FINE (i.e shows 4 days in the categorised column), when the agent runs all the dates are showing in mm/dd/yy format e.g

09/10/2006 08:54:12 AM AMgr: Agent (‘Date Testing’ in ‘test.nsf’) message box: 10/5/2006

09/10/2006 08:54:12 AM AMgr: Agent (‘Date Testing’ in ‘test.nsf’) message box: 10/05/2006

09/10/2006 08:54:12 AM AMgr: Agent (‘Date Testing’ in ‘test.nsf’) message box: 123

So how come on the Production Server the view shows 4 days (correctly) and the LS Agent takes the date in m/d/y format and returns 123 ?

But what REALLY confuses me is how it handles a date of 28th September 2006. In my view, all is ok. It shows 11 days. In the LotusScript agent I get.

09/10/2006 08:54:12 AM AMgr: Agent (‘Date Testing’ in ‘test.nsf’) message box: 9/28/2006

09/10/2006 08:54:12 AM AMgr: Agent (‘Date Testing’ in ‘tests.nsf’) message box: 28/09/2006

09/10/2006 08:54:12 AM AMgr: Agent (‘Date Testing’ in ‘test.nsf’) message box: -18

So not only do I have a weird value of -18, it’s also output the date in two formats - d/m/y and m/d/y (unlike the other document which resulted in two m/d/y outputs).

On my test server the script runs fine and shows the correct values.

What’s happening here??? Am I being stupid amd missing something obvious ?

Richard

Subject: Possible solution

Found this http://www.wfs.com/workweb/DLATrouble.nsf/740ef94ac62ac8a685256324006d4a58/f25d07863021ddff87256d27005bd3ae!OpenDocument

and then discovered that the production server has one of the date formats incorrectly set. Looks like this might be the problem.

Subject: RE: Possible solution

Dear Richard

It has to be one of the server settings that is resulting in the date-format being incorrect. Looks like you are along the right lines.

On another note however, did I understand that you have a categorised view column with @now or @today in the column formula??? You do realise that this will THRASH your server CPU as the view index will constantly be rebuilding?

If you are not doing so already, set the value of the difference in the documents themselves using your agent and then simply display this value in the view. The performance will be greatly improved.

There is a white paper available on the impact of using @now/@today in view/column formulas if you don’t believe me!

Subject: RE: Possible solution

Hi Melissa, thanks for that. Yes, I have @Today in the view column but it is untrue that this will “thrash the server CPU constantly” because my view Index is not set to be re-built automatically, it is only built when the view is required for use.