http://panther.sharedknowledgesystems.com:81/sharedknowledge/sksblog.nsf
05/31/2004 05:11:20 PM - What's the time? I've got the time,do you have the time? Can you tell me the time?

Permalink 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))
       



Comments

No documents found

Add Your Comments



Email addresses provided are not made available on this site.





You can use UUB Code in your posts.

[b]bold[/b]  [i]italic[/i]  [u]underline[/u]  [s]strikethrough[/s]

URL's will be automatically converted to Links


:-) :-D ;-) :-( :angry: :-o :grin: :cool: :laugh: :huh: :cry: :rolleyes: :-x :-p :-\ :emb: :lips:






Remember me    

Add Manual Trackback
Please enter the details of the trackback post. Your trackback will not appear on the site until it has been verified. This may take up to 10 minutes.

Site Name

Permanent URL of TrackBack Post

Title of Post ( If Any )

Excerpt of Post ( Max 250 Chars )



Calendar
February 2012
Su
Mo
Tu
We
Th
Fr
Sa
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29