Selection formula and timezone problem

Hi,

I have a C/C++ application that is searching a database based on a date/time field.

Depending on the timezones the involved parties are in, I am seeing different/confusing results:

when the machine that I am running my app and the Domino server that hosts the DB are both in a timezone that is observing DST, my selection will find the expected documents.

However, when the Domino server is in a timezone that is NOT observing DST, then the selected documents are 1 hour off.

To be more specific:

a document I am expecting to find has its timestamp set to

2008/09/25 10:56:00 GMT

my machine running the application is in GMT+1 with DST

my Domino server is in GMT+8 with NO DST

When I issue a select, the following formula is issued:

SELECT TimestampItem < @Date(2008;09;25;12;57;00)

  • which should be correct, as I am 2 hours off of GMT

However, what I am seeing is, that I will only find the document, when I am searching for it 1 hour later. And as I said, before, everything will be fine, if either the Domino server is also observing DST or both are NOT observing DST.

Am I doing something wrong or is this a bug in Notes?

Any help appreciated,

Thanks and regards,

Matt.

Subject: RE: Selection formula and timezone problem

I think you’ll need to say more, e.g. where this formula is being executed.

Subject: RE: Selection formula and timezone problem

I did a couple more tests and I have to revise what I said:

  • the timestamp against which I want to select is given to me as “millis since Jan, 1st, 1970” - so I am computing a Notes Time value and am unable to use something like @Adjust(@Now)

  • the formula is built in my C/C++ API application

  • the search (therefore the formula) is executed using the LNDatabase::Search() API

  • my further tests have shown that it doesn’t appear to be a DST problem after all, but that I have to specify the timestamp in server timezone to get the correct results.

So, my original problem is actually a different one:

I am sitting on a client and am only able to construct a formula without specifying any timezone specifics. The timestamp I am providing is in my client timezone, but Notes/Domino appears to interpret it as server timezone.

Is there anything I can do to

a) circumvent that

b) find out the time difference between my client timezone and the Domino server timezone

c) solve this problem without having to resort to relative times?

Hope this provides more details,

regards,

Matt.

Subject: RE: Selection formula and timezone problem

You don’t have to specify the time in the server’s timezone; you can do it instead by specifying the timezone, e.g. generating a string of the form fieldname > [8/5/2008 5:16:09 PM GMT] – of course you have to use the server’s ordering for dates, but you can also use @Adjust here from a known base date, e.g. fieldname > @Adjust([1/1/1970 12:00:00 AM GMT]; 0; 0; 0; 0; 0; offsetSecs)