LOTUSSCRIPT /COM/OLE のクラス
例:NotesDateTime クラス
1. 次のエージェントは、2005 年 3 月 4 日の午前 6 時 7 分 08 秒を示す NotesDateTime オブジェクトを作成します。DateNumber と TimeNumber を使用することで、地域設定への依存を避けます。
Sub Initialize
Dim dateTime As New NotesDateTime("")
dateTime.LocalTime = Datenumber(2005, 03, 04) + Timenumber(6, 7, 8)
Messagebox dateTime.LocalTime,, "Local time"
End Sub
2. 次のエージェントは、地域設定が M/d/yy h:mm:ss のように適切であれば、2005 年 3 月 4 日の午前 6 時 7 分 08 秒を示す NotesDateTime オブジェクトを作成します。String から日付を設定する場合は、ユーザーのコンピュータの地域設定が String 値に適切なものであることを確認する必要があります。
Sub Initialize
Dim session As New NotesSession
If session.International.IsDateMDY And _
session.International.DateSep = "/" And _
session.International.TimeSep = ":"Then
Dim dt As New NotesDateTime("3/4/05 6:07:08")
Messagebox dt.LocalTime,, "Local time"
Else
Messagebox "Not MDY with / and :",, "Date format not appropriate"
End If
End Sub
3. 次のエージェントは、今日の日付を示す新しい DateTime オブジェクトを作成します。DateTime オブジェクトの時刻の部分は設定されません。
Sub Initialize
Dim dt As New NotesDateTime("Today")
Messagebox dt.LocalTime,, "Local time"
End Sub
4. 次のエージェントは、現在の日付と時刻を示す新しい DateTime オブジェクトを作成します。
Sub Initialize
Dim dt As New NotesDateTime("Today")
Call dt.SetNow
Messagebox dt.LocalTime,, "Local time"
End Sub
5. 次のエージェントは文書の PurgeDate アイテムの値を取得して、それを NotesDateTime オブジェクトに設定します。PurgeDate のタイムゾーンの設定は変更されません。たとえば、[PurgeDate] が東部標準時で 03/21/96 04:54:33 PM の値を持つ場合、DateTime オブジェクトは 03/21/96 04:54:33 PM を表し、TimeZone プロパティは 5 になります。
Sub Initialize
Dim session As New NotesSession
Dim doc As NotesDocument
Dim item As NotesItem
Dim dt As NotesDateTime
Set doc = session.DocumentContext
Set item = doc.GetFirstItem("PurgeDate")
Set dt = item.DateTimeValue
Messagebox dt.LocalTime & " TZ" & dt.TimeZone,, "Local time"
End Sub
関連項目
NotesDateTime クラス
用語集
フィードバック
ヘルプ
または
プロダクトユーザビリティ
ヘルプの使い方
すべてのヘルプ項目
用語集