What's the time? I've got the time,do you have the time? Can you tell me the time?
There are times when its necessary to
merge the date in one field with the time in another field and then display
the results or perform date/time calculations. Prior to ND6, these feats
were accomplished in LotusScript and the formula language by converting
the values into string, concatenating them and then displaying them or
converting them back to date/time values.
Now in ND6 we've been given a new @function
- @TimeMerge. @TimeMerge creates a date/time value when supplied with a
date, time, and optionally a time zone. To see this function in action
you need only look at the appointment form in your mail database. @TimeMerge
is used in dispDuration_1, the field that displays the duration of the
meeting based on the start and end values. The related part of the formula
looks like this:
tmpStartNDT := @If(@IsNewDoc | @IsDocBeingEdited;@TimeMerge(@Date(@Year(StartDate);@Month(StartDate);@Day(StartDate));@Time(@Hour(StartTime);@Minute(StartTime);@Second(StartTime));StartTimeZone);
@IsAvailable(OrgRepeat) & @Elements(StartDateTime)
> 1;
Here the date parameter is built by
grabbing the year, month and day from the StartDate field. The time parameter
is built by pulling the hours, minutes and seconds from the StartTime field,
and the time zone comes from the StartTimeZone field.
This is followed by a similar formulas
for the End date/time value:
tmpEndNDT := @If(@IsNewDoc | @IsDocBeingEdited;
@TimeMerge(@Date(@Year(EndDate);@Month(EndDate);@Day(EndDate));@Time(@Hour(EndTime);@Minute(EndTime);@Second(EndTime));EndTimeZone);@IsAvailable(OrgRepeat)
& @Elements(EndDateTime) > 1; EndDateTime[@If(tmpindex = 0;1;tmpindex)];EndDateTime);
Eventually after some additional manipulations
and calculations, the meeting duration is displayed in the form.
Although there is no comparable method
in LotusScript for merging date and time values into a NotesDateTime object,
you can use Evaluate and @TimeMerge to achieve similar results. Here's
an example:
Dim
startDate As Variant
Dim
startTime As Variant
Dim startDateTime
As Variant
Dim currDateTime
As NotesDateTime
startDate=thisDoc.StartDate(0)
startTime=thisDoc.StartTime(0)
macro$="@TimeMerge(thisDoc.startDate;thisDoc.startTime)"
startDateTime=Evaluate(macro$,
thisDoc)
Set currDateTime=New
NotesDateTime(startDateTime(0))





-