LOTUSSCRIPT /COM/OLE のクラス
例:NotesDateTime クラス
1 次のスクリプトは 1995 年 8 月 18 日の午後 1 時 36 分 22 秒を表す NotesDateTime オブジェクトを新規作成します。
Dim dateTime As NotesDateTime
Set dateTime = New NotesDateTime( "98/08/18 01:36:22 PM" )
Messagebox( dateTime.LocalTime )
Messagebox( dateTime.GMTTime )
スクリプトはダイアログボックスに LocalTime プロパティの値を次のように表示します。「08/18/95 01:36:22 PM」
スクリプトは GMTTime プロパティの値をダイアログボックスに表示します。スクリプトが東部標準時に設定されたコンピュータで実行され、サマータイムが設定されている場合、「08/18/95 05:36:22 PM GMT」のように表示します。コンピュータが中部標準時に設定されているときは、「08/18/95 06:36:22 PM GMT」のように表示します。
2 次のスクリプトは上記のスクリプトと同じ NotesDateTime オブジェクトを新規作成します。
Dim dateTime As NotesDateTime
Set dateTime = New NotesDateTime( "98-08-18 01:36:22 PM" )
3 次のスクリプトは今日の日付を表す NotesDateTime オブジェクトを新規作成してから、ダイアログボックスに表示します。たとえば、今日が 1995 年 8 月 21 日である場合、スクリプトはダイアログボックスに「08/21/95」と表示します。NotesDateTime オブジェクトの時刻の部分は設定されません。
Dim dateTime As NotesDateTime
Set dateTime = New NotesDateTime( "Today" )
Messagebox( dateTime.LocalTime )
4 次のスクリプトは 1996 年 4 月 16 日 20 時 30 分を表す NotesDateTime オブジェクトを新規に作成します。日付の部分は 08:30:00 PM として保存されます。
Dim dateTime As New NotesDateTime( "98/04/16 20:30" )
Messagebox( dateTime.LSLocalTime )
Messagebox( dateTime.GMTTime )
スクリプトはダイアログボックスに LocalTime プロパティの値を次のように表示します。「04/16/96 08:30:00 PM」
スクリプトは GMTTime プロパティの値をダイアログボックスに表示します。たとえば、スクリプトが太平洋標準時に設定されたコンピュータで実行され、サマータイムが設定されているときは、「04/17/96 03:30:00 AM」のように表示します。
5 次のスクリプトは NotesDateTime オブジェクトを新規に 2 つ作成します。最初のオブジェクトは 1997 年 1 月 15 日を表し、2 番目のオブジェクトは 2000 年の 1 月 15 日を表します。
Dim olderDateTime As New NotesDateTime( "97/01/15" )
Dim newerDateTime As New NotesDateTime( "2000/01/15" )
6 次のスクリプトは文書の purgeDate アイテムの値を取得して、それを NotesDateTime オブジェクトに設定します。purgeDate のタイムゾーンの設定は変更されません。たとえば、[purgeDate] が東部標準時で 03/21/96 04:54:33 PM の値を持つとき、dateTime オブジェクトは 03/21/96 04:54:33 PM を表し、TimeZone プロパティは 5 になります。
Dim doc As NotesDocument
Dim item As NotesItem
Dim dateTime As NotesDateTime
'...set value of doc...
Set item = doc.GetFirstItem( "purgeDate" )
Set dateTime = item.DateTimeValue
7 次のスクリプトも文書の purgeDate アイテムの値を取得しますが、それを Variant 型変数 value に代入します。次に value を LSLocalTime プロパティの値として設定します。LotusScript の Variant 型変数 value はタイムゾーンの設定を保存しないため、purgeDate のタイムゾーンの設定は保存されません。dateTime オブジェクトは 03/21/96 04:54:33 を表しますが、その TimeZone プロパティはデフォルトの 0 になります。
Dim doc As NotesDocument
Dim item As NotesItem
Dim dateTime As NotesDateTime
Dim value As Variant
'...set value of doc...
Set item = doc.GetFirstItem( "purgeDate" )
Set dateTime = New NotesDateTime( "" )
value = item.Values
dateTime.LSLocalTime = value( 0 )
8 次のスクリプトはコレクションの最初の文書の [Schedule] フィールドを 09:00 PM に設定します。この時刻が LocalTime と GMTTime の両方のプロパティに表示されます。これは、
dateTime
パラメータで日付と時刻の両方を指定しなかったので、dateTime オブジェクトの TimeZone プロパティがデフォルトのゼロに設定されたためです。
Dim session As New NotesSession
Dim db As NotesDatabase
Dim dateTime As NotesDateTime
Dim c As NotesDocumentCollection
Dim doc As NotesDocument
Dim scheditem As NotesItem
Set db = session.CurrentDatabase
Set dateTime = New NotesDateTime("09:00 PM")
Set c = db.AllDocuments
Set doc = c.GetFirstDocument()
Set scheditem = doc.ReplaceItemValue("Schedule", dateTime)
Call doc.save(True,True)
Messagebox "Local time:" & dateTime.LocalTime & Chr(10)_
& "GMT:" & dateTime.GMTTime
関連項目
NotesDateTime クラス
用語集
ヘルプに対するフィードバック
ヘルプの使い方
ヘルプを開く
用語集
ヘルプに対するフィードバック
ヘルプの使い方
ヘルプを開く