报告日期时间问题

问题描述 投票:1回答:2

我在视图中存储了两个日期。而且我正在使用getItemValue来检索它们。

Dim repsondedDate As NotesDateTimeSet repsondedDate = timePart1doc.GetItemValue("dateResponded")

[当我尝试执行以下操作时,在运行时出现类型不匹配。

Dim dateDifference As double Set dtLocal = New NotesDateTime( Now ) dateDifference = repsondedDate.Timedifference(dtLocal)

有人对出什么问题有任何想法吗?

datetime lotusscript
2个回答
2
投票

以下行返回一个数组:

Set repsondedDate = timePart1doc.GetItemValue("dateResponded")

所以应该是:

Set repsondedDate = timePart1doc.GetItemValue("dateResponded")(0)

如果我没记错的话,您应该使用GetItemValueDateTimeArray方法而不是GetItemValue,因此实际上应该是这样的:

Set repsondedDate = timePart1doc.GetItemValueDateTimeArray("dateResponded")(0)

希望有所帮助


0
投票

[使用GetItemValueDateTimeArray代替下面的IBM example

Sub Initialize
  Dim session As New NotesSession
  Dim db As NotesDatabase
  Dim dc As NotesDocumentCollection
  Dim doc As NotesDocument
  Dim count As Integer
  Set db = session.CurrentDatabase
  Set dc = db.UnprocessedDocuments
  If dc.Count = 0 Then Exit Sub
  Set doc = dc.GetFirstDocument
  Dim times As Variant
  times = doc.GetItemValueDateTimeArray("Times")
  count = 0
  Forall t In times
    count = count + 1
    If Typename(t) = "NOTESDATETIME" Then
      Messagebox t.LocalTime,, "Date/time # " & count
    Elseif Typename(t) = "NOTESDATERANGE" Then
      Messagebox t.StartDateTime.LocalTime & " - " & _
      t.EndDateTime.LocalTime,, "Date/time # " & count
    End If
  End Forall
End Sub
© www.soinside.com 2019 - 2024. All rights reserved.