Q

Why does my calendar shift events by a day?

I have a calendar view that shows events entered into a database. There is a button on the view that shows two

days -- using code @Command([CalendarFormat]; "2"). When the above button is clicked, the calendar view shows tomorrow's events on today's day and moves everything back one day. Any ideas? I believe this problem is caused by a LotusScript programming error in the code that assigns the date fields in the documents.

The problem occurs when you assign a date field from a LotusScript date/time variant, using a statement such as:

apptDate = Datenumber(2002, 12, 13)
doc.CalDate = apptDate
or even
doc.CalDate = otherDoc.CalDate
The LotusScript date/time variant doesn't have a distinct representation for a date with no time -- it considers that the same as midnight on the given date, in the time zone of the computer running the script. As a result, if the user's workstation is in an earlier time zone than that computer, the entry would appear on the previous day's calendar page, because 12:00 a.m. in Boston, for example, is 11:00 p.m. on the previous day in Minneapolis.

To prevent this problem, always use the NotesDateTime class when working with date fields. In the above example:

Dim fldCalDate As NotesItem
Dim datCalDate As NotesDateTime
Set fldCalDate = otherDoc.GetFirstItem("CalDate")
Set datCalDate = fldCalDate.DateTimeValue
datCalDate.SetAnyTime ' in case there's a time value in the field we're copying, remove it.
Set doc.CalDate = datCalDate

This was first published in June 2003

Dig deeper on Domino Resources - Part 5

Have a question for an expert?

Please add a title for your question

Get answers from a TechTarget expert on whatever's puzzling you.

You will be able to add details on the next page.

0 comments

Oldest 

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to:

SearchWinIT

Search400

  • iSeries tutorials

    Search400.com's tutorials provide in-depth information on the iSeries. Our iSeries tutorials address areas you need to know about...

  • V6R1 upgrade planning checklist

    When upgrading to V6R1, make sure your software will be supported, your programs will function and the correct PTFs have been ...

  • Connecting multiple iSeries systems through DDM

    Working with databases over multiple iSeries systems can be simple when remotely connecting logical partitions with distributed ...

SearchEnterpriseLinux

SearchVirtualDataCentre.co.uk

Close