315 pts.
 date/time field in Lotus Notes
Hi All,

Can anybody please help me on this.

--- I have got two time fields. Time 1 and Time2.

    How can I compare both of these field in Lotus script ( not in forumula lanuguage).

Regards,



Software/Hardware used:
ASKED: September 12, 2009  7:01 AM
UPDATED: September 14, 2009  2:33 PM

Answer Wiki:
Not really sure what you want to compare, but here's some code that's straight from the Designer's Help file, under "Examples: NotesDateTime Class" 5. This agent gets the value of the PurgeDate item in a document and places it into a NotesDateTime object. The time zone setting of PurgeDate is preserved. For example, if PurgeDate has a value of 03/21/96 04:54:33 PM in Eastern Standard Time, the DateTime object represents 03/21/96 04:54:33 PM and its TimeZone property equals 5. Sub Initialize Dim session As New NotesSession Dim doc As NotesDocument Dim item As NotesItem Dim dt As NotesDateTime Set doc = session.DocumentContext Set item = doc.GetFirstItem("PurgeDate") Set dt = item.DateTimeValue Messagebox dt.LocalTime & " TZ" & dt.TimeZone,, "Local time" End Sub Combine the concepts from the above with the use of the .TimeDifference or .TimeDifferenceDouble methods of the class (also explained in the Designer's Help file), and you should be able to do what you want. Basically, diff = td1.TimeDifference( td2 )
Last Wiki Answer Submitted:  September 14, 2009  1:20 pm  by  Stiletto   2,700 pts.
All Answer Wiki Contributors:  Stiletto   2,700 pts.
To see all answers submitted to the Answer Wiki: View Answer History.


Discuss This Question:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _


 

…and it can be as simple as

difference = Now – doc.MyDateField(0)

or

difference = Now – doc.Created

Then,

Msgbox difference

will reveal the number of days in the integer part of the result, and the fraction of a day to the right of the decimal.

 1,620 pts.