If you have a time and a date field, you can convert that to a notes date time by doing this:
Dim niTime as notesitem
Dim TimeRequired as new notesdatetime("")
Set niTime = doc.getfirstitem("Time")
Set TimeRequired = New NotesDateTime(niTime.text)
set niDate as notesitem
Dim DateRequired as new notesdatetime("")
Set niDate = doc.getfirstitem("Date)
Set DateRequired = New NotesDateTime(niDate.text & " " & niTime.text)
If you have a time field and you wish to make it work with any date try this:
Set TimeRequired = New notesdatetime ( niTime.text )
Time.setanydate
Time difference and timedoubledifference (notes 5 only) can be read as "minus".
Remember that later dates are bigger than earlier dates.
eg
if clashend.timedifferencedouble(gapstarttime)<=0 Then
msgbox "clash ends before we need to start so ok"
elseif clashstart.timedifferencedouble(gapenddateAndtime)>=0 Then
msgbox "Clash starts after our start time so ok"
else
msgbox "Could be a clash"
end if
Replacing a notes time with a notesdatetime value:
Set ni = doc.replaceitemvalue("start",ndtStart.lslocaltime)
To replace a time only value you need to have set .setanydate on the ndt first.
Set ndtTime = New notesdatetime ( niTime.text )
ndtTime.setanydate
Set ni = doc.replaceitemvalue("time",ndtTime.lslocaltime)
Note: This looks different in the notes document but there is no other way.
A time only field created by a form is type: "Time/Date List or Range" and is "16:15:00"
Created by lotusscript it is type: "Time/Date" and is "30/12/1899 16:15:00 GMT"
The second field used in calendar field is type number and shows the range of a booking.
The duration field is in minutes not seconds so should be divided by 60:
bookdoc.duration=(ndtgapend.timedifference( ndtgapstart) )/60
You must make sure the busy rows are a different colour in the view/folder properties.
I find the 2 day view is most effective for showing busy times.
If you want to update a text field with today's date and or time try this:
dim ndt as new notesdatetime("")
call ndt.setnow()
call doc.replaceitemvalue("Last_Updated", ndt.dateonly)
call doc.replaceitemvalue("Last_Updated", ndt.timeonly)
call doc.replaceitemvalue("Last_Updated", ndt.zonetime)
Convert NotesDocument & Notesitem properties to Notesdatetime values: lastmodified created lastaccessed
dim lmndt as notesdatetime
Set lmndt = New notesdatetime("")
lmndt.LSLocalTime = doc.LastModified
If lastrun.TimeDifferenceDouble(lmndt)<0 Then needToUpdate=True
Add a notesdatetime field to a document that does not have time data
eg 12/02/2010 instead of 12/02/2010 00:00:00
Dim loopdatetime As NotesDateTime
Dim workdatetime As notesdatetime
Set workdatetime = New NotesDateTime(loopdatetime.DateOnly)
Call workdatetime.setanytime
Call tdoc.replaceitemvalue("Workdate",workdatetime )
For time and date picking solutions please check out notes templates.