LocalTime (NotesDateTime - JavaScript)

読み書き可能。ローカルタイムゾーンの日付/時刻を表すストリング。

定義場所

NotesDateTime

構文

getLocalTime() : string

setLocalTime(dt:string) : void

setLocalTime(hour:int, minute:int, second:int, hundredth:int) : void

setLocalTime(dt:Date) : void

setLocalDate(year:int, month:int, day:int) : void

setLocalDate(year:int, month:int, day:int, preserveLocalTime:boolean) : void

使用法

数値パラメータは、例えば parseInt などを使用して int にしなければなりません。

このプロパティを設定すると、オブジェクトが表す日付/時刻の値が変更されるため、GMTTime プロパティに影響します。

dtyearmonthdayhourminutesecondhundredth パラメータによって、新しい時刻が指定されます。preserveLocalTime パラメータは、サマータイムの地域の境界を超える既存の日付からの調整に影響します。24 時間調整をした場合に次の日の同じ現地時間になるように、GMT 時刻を 1 時間増減させる場合は、true を指定します。パラメータが false または省略されている場合、GMT 時間は調整されたままとなり、現地時間は 1 時間増減されます。

Date オブジェクトを使用してこのプロパティを設定すると、タイムゾーンも変わる場合があります。

以下の計算結果フィールドには、現在のデータベースの作成日時が表示されます。
var dt:NotesDateTime = database.getCreated();
return "This database was created on " + dt.getLocalTime();
入力ボックス (requestScope.date にバインド) に対する以下の onclick イベントは、ユーザー入力に基づいて日付/時刻の値を設定します。正しい日付であるかどうかは、ユーザー入力が有効であるかどうかに依存します。
// Create valid NotesDateTime object
var dt:NotesDateTime = session.createDateTime("Today 12");
// requestScope variables are bound to numeric input boxes
// must convert numeric user input to int
var year = parseInt(requestScope.year, 10);
var month = parseInt(requestScope.month, 10);
var day = parseInt(requestScope.day, 10);
var hour = parseInt(requestScope.hour, 10);
var minute = parseInt(requestScope.minute, 10);
var second = parseInt(requestScope.second, 10);
var hundredth = parseInt(requestScope.hundredth, 10);
// Set date and time from user input
try {
	dt.setLocalDate(year, month, day, true);
} catch(e) {
	requestScope.date = "Illegal specification for date";
	return;
}
try {
	dt.setLocalTime(hour, minute, second, hundredth);
} catch(e) {
	requestScope.date = "Illegal specification for time";
	return;
}
// Post local time to input box
requestScope.date = dt.getLocalTime();
入力ボックス (requestScope.date にバインド) に対する以下の onclick イベントは、ユーザー入力に基づいて日付/時刻の値を設定します。正しい日付であるかどうかは、ユーザー入力ストリングが有効であるかどうかに依存します。
// Create valid NotesDateTime object
var dt:NotesDateTime = session.createDateTime("Today 12");
// Get date from user and set
dt.setLocalTime(requestScope.dt);
// Display date-time
requestScope.date = dt.getLocalTime();
入力ボックス (requestScope.date にバインド) に対する以下の onclick イベントは、ユーザー入力に基づいて日付/時刻の値を設定します。正しい日付であるかどうかは、ユーザー入力が有効であるかどうかに依存します。
// Create valid NotesDateTime object
var dt:NotesDateTime = session.createDateTime("Today 12");
// Create Date object (note: January = 0 for Date)
// requestScope variables are bound to numeric input boxes
var date:Date = new Date(requestScope.year, (requestScope.month) - 1, requestScope.day,
requestScope.hour, requestScope.minute, requestScope.second, requestScope.hundredth);
// Set time
dt.setLocalTime(date);
// Post local time
requestScope.date = dt.getLocalTime();

言語間の参照

LotusScript® NotesDateTime クラスの LocalTime プロパティ

Java™ DateTime クラスの LocalTime プロパティ