Lotusscript 日期时间问题

发布于 2024-09-24 12:53:43 字数 391 浏览 3 评论 0原文

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

将repsondedDate变暗为NotesDateTime
Set repsondedDate = timePart1doc.GetItemValue("dateResponded")

当我尝试执行以下操作时,我在运行时遇到类型不匹配的情况。

Dim dateDifference As double
设置 dtLocal = New NotesDateTime( 现在 )
dateDifference = repsondedDate.Timedifference(dtLocal)

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

I have a couple of dates stored in a view. And I am using getItemValue to retrieve them.

Dim repsondedDate As NotesDateTime
Set repsondedDate = timePart1doc.GetItemValue("dateResponded")

When I try to do the following, I get a type missmatch at run time.

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

Does anyone have any ideas on what is going wrong?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

烟─花易冷 2024-10-01 12:53:43

以下行返回一个数组:

Set repsondedDate = timePart1doc.GetItemValue("dateResponded")

所以应该是:

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

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

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

希望有帮助

The following line returns an array:

Set repsondedDate = timePart1doc.GetItemValue("dateResponded")

So it should be:

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

If I'm not mistaken you should be using the GetItemValueDateTimeArray method instead of the GetItemValue, so it should actually be like this:

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

Hope that helps

止于盛夏 2024-10-01 12:53:43

请改用 GetItemValueDateTimeArray,如下面的 IBM 示例 :

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

Use GetItemValueDateTimeArray instead like the IBM example below:

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
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文