| パッケージ | トップレベル |
| public final dynamic class Date | |
| 継承 | Date Object |
Date.UTC() メソッドと Date.parse() メソッドは例外であり、これらは静的なメソッドです。Date クラスによる夏時間の処理方法は、オペレーティングシステムおよび Flash Player のバージョンに応じて異なります。Flash Player 6 以降では、夏時間は各オペレーティングシステムで次のように処理されます。
Flash Player 5 によるオペレーティングシステム別の夏時間の対処方法は次のとおりです。
Date クラスを使用するには、new 演算子を使用して Date インスタンスを作成します。
ActionScript 3.0 は新しいアクセサプロパティをいくつか追加しています。これらのアクセサプロパティは、Date インスタンスにアクセスしたり、Date インスタンスを変更する多くの Date クラスメソッドの代わりに使用できます。また、ActionScript 3.0 には、ECMA-262 Edition 3 に準拠するために組み込まれている、toString() メソッドの新しい変形メソッド (Date.toLocaleString()、Date.toTimeString()、Date.toLocaleTimeString()、Date.toDateString()、および Date.toLocaleDateString()) も含まれます。
相対時間または経過時間を計算するには、flash.utils パッケージに含まれる getTimer() メソッドを参照してください。
関連項目
| プロパティ | 定義 | ||
|---|---|---|---|
![]() | constructor : Object
指定されたオブジェクトインスタンスのクラスオブジェクトまたはコンストラクタ関数への参照です。
| Object | |
date : Number
Date オブジェクトで指定されたローカル時間による日付 (1 ~ 31 の整数) です。 | Date | ||
dateUTC : Number
Date オブジェクトの世界時 (UTC) による日付 (1 ~ 31 の整数) です。 | Date | ||
| day : Number
[read-only]
この
Date で指定されたローカル時間による曜日 (日曜日は 0、月曜日は 1 など) です。 | Date | ||
| dayUTC : Number
[read-only]
この
Date
の世界時 (UTC) による曜日 (日曜日は 0、月曜日は 1 など) です。 | Date | ||
fullYear : Number
Date オブジェクトのローカル時間による年 (2000 などの 4 桁の数字) です。 | Date | ||
fullYearUTC : Number
Date オブジェクトの世界時 (UTC) による 4 桁の年です。 | Date | ||
hours : Number
Date オブジェクトのローカル時間による時 (0 ~ 23 の整数) 部分です。 | Date | ||
hoursUTC : Number
Date オブジェクトの世界時 (UTC) による時 (0 ~ 23 の整数) です。 | Date | ||
milliseconds : Number
Date オブジェクトのローカル時間によるミリ秒 (0 ~ 999 の整数) 部分です。 | Date | ||
millisecondsUTC : Number
Date オブジェクトの世界時 (UTC) によるミリ秒 (0 ~ 999 の整数) 部分です。 | Date | ||
minutes : Number
Date オブジェクトのローカル時間による分 (0 ~ 59 の整数) 部分です。 | Date | ||
minutesUTC : Number
Date オブジェクトの世界時 (UTC) による分 (0 ~ 59 の整数) 部分です。 | Date | ||
month : Number
Date オブジェクトのローカル時間による月 (1 月は 0、2 月は 1 など) です。 | Date | ||
monthUTC : Number
Date オブジェクトの世界時 (UTC) による月 (0 [1 月] ~ 11 [12 月]) 部分です。 | Date | ||
![]() | prototype : Object
[static]
クラスまたは関数オブジェクトのプロトタイプオブジェクトへの参照です。
| Object | |
seconds : Number
Date オブジェクトのローカル時間による秒 (0 ~ 59 の整数) 部分です。 | Date | ||
secondsUTC : Number
Date オブジェクトの世界時 (UTC) による秒 (0 ~ 59 の整数) 部分です。 | Date | ||
time : Number
Date オブジェクトの 1970 年 1 月 1 日 0 時 (世界時) からのミリ秒数です。 | Date | ||
| timezoneOffset : Number
[read-only]
世界時 (UTC) とコンピュータのローカル時間の差 (分単位) です。
| Date | ||
| メソッド | 定義 | ||
|---|---|---|---|
|
Date(yearOrTimevalue:Object, month:Number, date:Number = 1, hour:Number = 0, minute:Number = 0, second:Number = 0, millisecond:Number = 0)
指定された日時を保持する新しい Date オブジェクトを作成します。
| Date | ||
Date オブジェクトで指定された日付 (1 ~ 31 の整数) をローカル時間で返します。 | Date | ||
|
この
Date で指定された曜日 (日曜日は 0、月曜日は 1 など) をローカル時間で返します。 | Date | ||
Date オブジェクトの年 (2000 などの 4 桁の数字) をローカル時間で返します。 | Date | ||
Date オブジェクトの時 (0 ~ 23 の整数) 部分をローカル時間で返します。 | Date | ||
Date オブジェクトのミリ秒 (0 ~ 999 の整数) 部分をローカル時間で返します。 | Date | ||
Date オブジェクトの分 (0 ~ 59 の整数) 部分をローカル時間で返します。 | Date | ||
|
この
Date の月 (1 月は 0、2 月は 1 など) 部分をローカル時間で返します。 | Date | ||
Date オブジェクトの秒 (0 ~ 59 の整数) 部分をローカル時間で返します。 | Date | ||
Date オブジェクトの 1970 年 1 月 1 日 0 時 (世界時) からのミリ秒数を返します。 | Date | ||
|
世界時 (UTC) とコンピュータのローカル時間の差 (分単位) を返します。
| Date | ||
Date オブジェクトの日付 (1 ~ 31 の整数) を世界時 (UTC) で返します。 | Date | ||
|
この
Date
の曜日 (日曜日は 0、月曜日は 1 など) を世界時 (UTC) で返します。 | Date | ||
Date オブジェクトの 4 桁の年を世界時 (UTC) で返します。 | Date | ||
Date オブジェクトの時 (0 ~ 23 の整数) を世界時 (UTC) で返します。 | Date | ||
Date オブジェクトのミリ秒 (0 ~ 999 の整数) 部分を世界時 (UTC) で返します。 | Date | ||
Date オブジェクトの分 (0 ~ 59 の整数) 部分を世界時 (UTC) で返します。 | Date | ||
Date オブジェクトの月 (0 [1 月] ~ 11 [12 月]) 部分を世界時 (UTC) で返します。 | Date | ||
Date オブジェクトの秒 (0 ~ 59 の整数) 部分を世界時 (UTC) で返します。 | Date | ||
![]() |
指定されたプロパティがオブジェクトに定義されているかどうかを示します。
| Object | |
![]() |
Object クラスのインスタンスが、パラメータとして指定されたオブジェクトのプロトタイプチェーン内にあるかどうかを示します。
| Object | |
|
[static]
日付を表すストリングを、1970 年 1 月 1 日 (UTC) から経過したミリ秒数に相当する数値に変換します。
| Date | ||
![]() |
指定されたプロパティが存在し、列挙できるかどうかを示します。
| Object | |
|
月内の日付をローカル時間で設定し、新しい時刻をミリ秒で返します。
| Date | ||
|
年をローカル時間で設定し、新しい時刻をミリ秒で返します。
| Date | ||
|
時をローカル時間で設定し、新しい時刻をミリ秒で返します。
| Date | ||
|
ミリ秒をローカル時間で設定し、新しい時刻をミリ秒で返します。
| Date | ||
|
分をローカル時間で設定し、新しい時刻をミリ秒で返します。
| Date | ||
|
月と、オプションで日付をローカル時間で設定し、新しい時刻をミリ秒で返します。
| Date | ||
![]() |
ループ処理に対するダイナミックプロパティの可用性を設定します。
| Object | |
|
秒をローカル時間で設定し、新しい時刻をミリ秒で返します。
| Date | ||
|
日付を 1970 年 1 月 1 日 0 時からのミリ秒数で設定し、新しい時刻をミリ秒で返します。
| Date | ||
|
月内の日付を世界時 (UTC) で設定し、新しい時刻をミリ秒で返します。
| Date | ||
|
年を世界時 (UTC) で設定し、新しい時刻をミリ秒で返します。
| Date | ||
|
時を世界時 (UTC) で設定し、新しい時刻をミリ秒で返します。
| Date | ||
|
ミリ秒を世界時 (UTC) で設定し、新しい時刻をミリ秒で返します。
| Date | ||
|
分を世界時 (UTC) で設定し、新しい時刻をミリ秒で返します。
| Date | ||
|
月、およびオプションで日を世界時 (UTC) で設定し、新しい時刻をミリ秒で返します。
| Date | ||
|
秒、およびオプションでミリ秒を世界時 (UTC) で設定し、新しい時刻をミリ秒で返します。
| Date | ||
|
曜日と日付のみのストリング表現を返します。時刻またはタイムゾーンは含まれません。
| Date | ||
|
曜日と日付のみのストリング表現を返します。時刻またはタイムゾーンは含まれません。
| Date | ||
|
曜日、日付、時刻のストリング表現を、指定されたローカル時間で返します。
| Date | ||
|
時刻のみのストリング表現を返します。曜日、日付、年、またはタイムゾーンは含まれません。
| Date | ||
|
曜日、日付、時刻、およびタイムゾーンのストリング表現を返します。
| Date | ||
|
時刻とタイムゾーンのみのストリング表現を返します。曜日と日付は含まれません。
| Date | ||
|
曜日、日付、および時刻のストリング表現を世界時 (UTC) で返します。
| Date | ||
|
UTC(year:Number, month:Number, date:Number = 1, hour:Number = 0, minute:Number = 0, second:Number = 0, millisecond:Number = 0):Number
[static]
1970 年 1 月 1 日 0 時 (世界時) からパラメータで指定された時刻までのミリ秒数を返します。
| Date | ||
Date オブジェクトの 1970 年 1 月 1 日 0 時 (世界時) からのミリ秒数を返します。 | Date | ||
| date | プロパティ |
date:Number [read-write]
Date オブジェクトで指定されたローカル時間による日付 (1 ~ 31 の整数) です。ローカル時間は、Flash Player を実行しているオペレーティングシステムによって決まります。
AS3 function get date():Number
AS3 function set date(value:Number):void
関連項目
| dateUTC | プロパティ |
dateUTC:Number [read-write]
Date オブジェクトの世界時 (UTC) による日付 (1 ~ 31 の整数) です。
AS3 function get dateUTC():Number
AS3 function set dateUTC(value:Number):void
関連項目
| day | プロパティ |
day:Number [read-only]
この Date で指定されたローカル時間による曜日 (日曜日は 0、月曜日は 1 など) です。ローカル時間は、Flash Player を実行しているオペレーティングシステムによって決まります。
AS3 function get day():Number
関連項目
| dayUTC | プロパティ |
dayUTC:Number [read-only]
この Date
の世界時 (UTC) による曜日 (日曜日は 0、月曜日は 1 など) です。
AS3 function get dayUTC():Number
関連項目
| fullYear | プロパティ |
fullYear:Number [read-write]
Date オブジェクトのローカル時間による年 (2000 などの 4 桁の数字) です。ローカル時間は、Flash Player を実行しているオペレーティングシステムによって決まります。
AS3 function get fullYear():Number
AS3 function set fullYear(value:Number):void
関連項目
| fullYearUTC | プロパティ |
fullYearUTC:Number [read-write]
Date オブジェクトの世界時 (UTC) による 4 桁の年です。
AS3 function get fullYearUTC():Number
AS3 function set fullYearUTC(value:Number):void
関連項目
| hours | プロパティ |
hours:Number [read-write]
Date オブジェクトのローカル時間による時 (0 ~ 23 の整数) 部分です。ローカル時間は、Flash Player を実行しているオペレーティングシステムによって決まります。
AS3 function get hours():Number
AS3 function set hours(value:Number):void
関連項目
| hoursUTC | プロパティ |
hoursUTC:Number [read-write]
Date オブジェクトの世界時 (UTC) による時 (0 ~ 23 の整数) です。
AS3 function get hoursUTC():Number
AS3 function set hoursUTC(value:Number):void
関連項目
| milliseconds | プロパティ |
milliseconds:Number [read-write]
Date オブジェクトのローカル時間によるミリ秒 (0 ~ 999 の整数) 部分です。ローカル時間は、Flash Player を実行しているオペレーティングシステムによって決まります。
AS3 function get milliseconds():Number
AS3 function set milliseconds(value:Number):void
関連項目
| millisecondsUTC | プロパティ |
millisecondsUTC:Number [read-write]
Date オブジェクトの世界時 (UTC) によるミリ秒 (0 ~ 999 の整数) 部分です。
AS3 function get millisecondsUTC():Number
AS3 function set millisecondsUTC(value:Number):void
関連項目
| minutes | プロパティ |
minutes:Number [read-write]
Date オブジェクトのローカル時間による分 (0 ~ 59 の整数) 部分です。ローカル時間は、Flash Player を実行しているオペレーティングシステムによって決まります。
AS3 function get minutes():Number
AS3 function set minutes(value:Number):void
関連項目
| minutesUTC | プロパティ |
minutesUTC:Number [read-write]
Date オブジェクトの世界時 (UTC) による分 (0 ~ 59 の整数) 部分です。
AS3 function get minutesUTC():Number
AS3 function set minutesUTC(value:Number):void
関連項目
| month | プロパティ |
month:Number [read-write]
Date オブジェクトのローカル時間による月 (1 月は 0、2 月は 1 など) です。ローカル時間は、Flash Player を実行しているオペレーティングシステムによって決まります。
AS3 function get month():Number
AS3 function set month(value:Number):void
関連項目
| monthUTC | プロパティ |
monthUTC:Number [read-write]
Date オブジェクトの世界時 (UTC) による月 (0 [1 月] ~ 11 [12 月]) 部分です。
AS3 function get monthUTC():Number
AS3 function set monthUTC(value:Number):void
関連項目
| seconds | プロパティ |
seconds:Number [read-write]
Date オブジェクトのローカル時間による秒 (0 ~ 59 の整数) 部分です。ローカル時間は、Flash Player を実行しているオペレーティングシステムによって決まります。
AS3 function get seconds():Number
AS3 function set seconds(value:Number):void
関連項目
| secondsUTC | プロパティ |
secondsUTC:Number [read-write]
Date オブジェクトの世界時 (UTC) による秒 (0 ~ 59 の整数) 部分です。
AS3 function get secondsUTC():Number
AS3 function set secondsUTC(value:Number):void
関連項目
| time | プロパティ |
time:Number [read-write]
Date オブジェクトの 1970 年 1 月 1 日 0 時 (世界時) からのミリ秒数です。このメソッドは、複数の Date オブジェクトを比較する際に特定の時間を表すのに使用します。
AS3 function get time():Number
AS3 function set time(value:Number):void
関連項目
| timezoneOffset | プロパティ |
timezoneOffset:Number [read-only]世界時 (UTC) とコンピュータのローカル時間の差 (分単位) です。つまり、この値は、世界時と等しくするためにコンピュータのローカル時間に加算する必要がある分数になります。コンピュータの時刻が世界時より遅い時間に設定されている場合、戻り値は負の数になります。
実装 AS3 function get timezoneOffset():Number
関連項目
| Date | () | コンストラクタ |
public 関数 Date(yearOrTimevalue:Object, month:Number, date:Number = 1, hour:Number = 0, minute:Number = 0, second:Number = 0, millisecond:Number = 0)指定された日時を保持する新しい Date オブジェクトを作成します。
Date() コンストラクタは、日付と、ミリ秒までの時刻を指定するために、最大 7 つまでパラメータ (year、month、...、millisecond) を取ります。新しく作成された Date オブジェクトに含まれる日付は、渡された引数の数とデータ型により異なります。
Date クラスのコンストラクタにストリングを渡す場合、日付にはさまざまな形式を使用できますが、少なくとも月、日、年が含まれている必要があります。たとえば、Feb 1 2005 は有効ですが、Feb 2005 は無効です。次に、有効な形式をいくつか示します。
toString() に対応します。)toLocaleString() に対応します。)toDateString() に対応します。)yearOrTimevalue:Object — 他のパラメータが指定されている場合、この数値は年 (1965 年など) を表します。それ以外の場合は時間値を表します。数値が年を表す場合、0 ~ 99 の値は 1900 ~ 1999 を表します。それ以外の場合は年を 4 桁で指定する必要があります。数値が時間値を表す (他にパラメータが指定されない) 場合は、1970 年 1 月 1 日 0:00:00 を基準とする経過時間をミリ秒単位で表す値になります。負の値は 1970 年 1 月 1 日 0:00:00 GMT よりも前の時刻を表し、正の値はそれより後の時刻を表します。
|
|
month:Number — 0 (1 月) ~ 11 (12 月) の整数です。
|
|
date:Number (default = 1) — 1 ~ 31 の整数です。
|
|
hour:Number (default = 0) — 0 (0 時) ~ 23 (午後 11 時) の整数です。
|
|
minute:Number (default = 0) — 0 ~ 59 の整数です。
|
|
second:Number (default = 0) — 0 ~ 59 の整数です。
|
|
millisecond:Number (default = 0) — ミリ秒の 0 ~ 999 の整数です。
|
関連項目
| getDate | () | メソッド |
AS3 function getDate():Number
Date オブジェクトで指定された日付 (1 ~ 31 の整数) をローカル時間で返します。ローカル時間は、Flash Player を実行しているオペレーティングシステムによって決まります。
Number —
Date オブジェクトが表す日付 (1 ~ 31) です。
|
関連項目
someBirthday with parameters year (1974), month (10 = November), day (30), hour (1) and minute (20). The getDate() method is then called, which retrieves the day of the month. package { import flash.display.Sprite;
public class DateExample extends Sprite {
public function DateExample() { var someBirthday:Date = new Date(1974, 10, 30, 1, 20); trace(someBirthday); // Sat Nov 30 01:20:00 GMT-0800 1974 trace(someBirthday.getDate()); // 30 } } }
| getDay | () | メソッド |
AS3 function getDay():Number
この Date で指定された曜日 (日曜日は 0、月曜日は 1 など) をローカル時間で返します。ローカル時間は、Flash Player を実行しているオペレーティングシステムによって決まります。
Number —
Date オブジェクトが表す曜日の数値 (0 ~ 6) です。
|
weekDayLabels, with elements [Sunday,Monday,Tuesday,Wednesday,Thursday,Friday,Saturday] and a new Date object someBirthday with parameters year (1974), month (10 = November), day (30), hour (1) and minute (20). The getDay() method is then called twice, which first shows the day of the month as 6 and then shows the day of the week using weekDayLabels.
var weekDayLabels:Array = new Array("Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday");
var someBirthday:Date = new Date(1974, 10, 30, 1, 20); trace(someBirthday); // Sat Nov 30 01:20:00 GMT-0800 1974 trace(someBirthday.getDay()); // 6 trace(weekDayLabels[someBirthday.getDay()]); // Saturday
| getFullYear | () | メソッド |
AS3 function getFullYear():Number
Date オブジェクトの年 (2000 などの 4 桁の数字) をローカル時間で返します。ローカル時間は、Flash Player を実行しているオペレーティングシステムによって決まります。
Number —
Date オブジェクトが表す 4 桁の年です。
|
someBirthday with parameters year (1974), month (10 = November), day (30), hour (1) and minute (20). The getFullYear() method is then called, which retrieves the four-digit year. var someBirthday:Date = new Date(1974, 10, 30, 1, 20); trace(someBirthday); // Sat Nov 30 01:20:00 GMT-0800 1974 trace(someBirthday.getFullYear()); // 1974
| getHours | () | メソッド |
AS3 function getHours():Number
Date オブジェクトの時 (0 ~ 23 の整数) 部分をローカル時間で返します。ローカル時間は、Flash Player を実行しているオペレーティングシステムによって決まります。
Number —
Date オブジェクトが表す時 (0 ~ 23) です。
|
someBirthday with parameters year (1974), month (10 = November), day (30), hour (1) and minute (20). The getHours() and getMinutes() methods are then called, which retrieves the hours and the minutes in 24-hour format. Finally, a string localTime is created and assigned to the result of a call to the function getUSClockTime(), which, in turn calls getHours() and getMinutes() again, resulting in the time 03:05 PM.
var someBirthday:Date = new Date(1974, 10, 30, 15, 5);
trace(someBirthday); // Sat Nov 30 15:20:00 GMT-0800 1974 trace(someBirthday.getHours() + ":" + someBirthday.getMinutes()); // 15:5
var localTime:String = getUSClockTime(someBirthday.getHours(), someBirthday.getMinutes()); trace(localTime); // 03:05 PM
function getUSClockTime(hrs:uint, mins:uint):String { var modifier:String = "PM"; var minLabel:String = doubleDigitFormat(mins);
if(hrs > 12) { hrs = hrs-12; } else if(hrs == 0) { modifier = "AM"; hrs = 12; } else if(hrs < 12) { modifier = "AM"; }
return (doubleDigitFormat(hrs) + ":" + minLabel + " " + modifier); }
function doubleDigitFormat(num:uint):String { if(num < 10) { return ("0" + num); } return num; }
| getMilliseconds | () | メソッド |
AS3 function getMilliseconds():Number
Date オブジェクトのミリ秒 (0 ~ 999 の整数) 部分をローカル時間で返します。ローカル時間は、Flash Player を実行しているオペレーティングシステムによって決まります。
Number —
Date オブジェクトのミリ秒部分です。
|
now with no parameters. The getMilliseconds() method is then called, which retrieves the milliseconds of the Date object now at the time it was created. var now:Date = new Date(); trace(now.getMilliseconds());
| getMinutes | () | メソッド |
AS3 function getMinutes():Number
Date オブジェクトの分 (0 ~ 59 の整数) 部分をローカル時間で返します。ローカル時間は、Flash Player を実行しているオペレーティングシステムによって決まります。
Number —
Date オブジェクトの分部分です。
|
now with no parameters. The getMinutes() method is then called, which retrieves the minutes of the Date object now at the time it was created. var now:Date = new Date(); trace(now); trace(now.getMinutes());
| getMonth | () | メソッド |
AS3 function getMonth():Number
この
Date の月 (1 月は 0、2 月は 1 など) 部分をローカル時間で返します。ローカル時間は、Flash Player を実行しているオペレーティングシステムによって決まります。
Number —
Date オブジェクトの月 (0 ~ 11) 部分です。
|
monthLabels, with elements January through December and a new Date object now with no parameters. The getMonth() method is then called twice, which first returns the month number and then the month name of the month the Date object now was created.
var monthLabels:Array = new Array("January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December");
var now:Date = new Date(); trace(now.getMonth()); trace(monthLabels[now.getMonth()]);
| getSeconds | () | メソッド |
AS3 function getSeconds():Number
Date オブジェクトの秒 (0 ~ 59 の整数) 部分をローカル時間で返します。ローカル時間は、Flash Player を実行しているオペレーティングシステムによって決まります。
Number —
Date オブジェクトの秒 (0 ~ 59 の整数) 部分です。
|
now with no parameters. The getSeconds() method is then called, which retrieves the seconds of the Date object now at the time it was created. var now:Date = new Date(); trace(now.getSeconds());
| getTime | () | メソッド |
AS3 function getTime():Number
Date オブジェクトの 1970 年 1 月 1 日 0 時 (世界時) からのミリ秒数を返します。このメソッドは、複数の Date オブジェクトを比較する際に特定の時間を表すのに使用します。
Number —
Date オブジェクトが表す 1970 年 1 月 1 日からのミリ秒数です。
|
mlk with parameters year (1929), month (0 = January), and day (15). The getTime() method is then called, which retrieves the milliseconds since midnight January 1, 1970, which is negative since the year is set to 1929. var mlk:Date = new Date(1929, 0, 15); trace(mlk); // Tue Jan 15 00:00:00 GMT-0800 1929 trace(mlk.getTime()); // -1292601600000
now with no parameters and then uses the following DateMath (created below) class methods to add time to the original Date object now from the time it was created: addSeconds(): adds 30 seconds to now.addMinutes(): adds 30 minutes to now.addHours(): adds 6 hours to the Date object now.addDays(): adds 30 days to the Date object now.addWeeks(): adds 4 weeks to now.
var now:Date = new Date(); trace(now); trace(DateMath.addSeconds(now, 30)); trace(DateMath.addMinutes(now, 30)); trace(DateMath.addHours(now, 6)); trace(DateMath.addDays(now, 30)); trace(DateMath.addWeeks(now, 4));
class DateMath { public static function addWeeks(date:Date, weeks:Number):Date { return addDays(date, weeks*7); }
public static function addDays(date:Date, days:Number):Date { return addHours(date, days*24); }
public static function addHours(date:Date, hrs:Number):Date { return addMinutes(date, hrs*60); }
public static function addMinutes(date:Date, mins:Number):Date { return addSeconds(date, mins*60); }
public static function addSeconds(date:Date, secs:Number):Date { var mSecs:Number = secs * 1000; var sum:Number = mSecs + date.getTime(); return new Date(sum); } }
function addMonths(num:Number):void { currentMonth = currentMonth + num; if(currentMonth > 12) { currentYear++; currentMonth = currentMonth - 12; } } | getTimezoneOffset | () | メソッド |
AS3 function getTimezoneOffset():Number世界時 (UTC) とコンピュータのローカル時間の差 (分単位) を返します。
戻り値Number —
世界時と等しくするためにコンピュータのローカル時間に加算する必要がある分数です。コンピュータの時刻が世界時より遅い時間に設定されている場合、戻り値は負の数になります。
|
now with no parameters. The getTimezoneOffset() method is then called, which retrieves the difference (in minutes) of the time now was created and Universal Time. The time zone offset is then converted to hours by dividing the result by 60. var date:Date = new Date(); trace(date.getTimezoneOffset() / 60);
| getUTCDate | () | メソッド |
AS3 function getUTCDate():Number
Date オブジェクトの日付 (1 ~ 31 の整数) を世界時 (UTC) で返します。
Number —
Date オブジェクトが表す UTC の日付 (1 ~ 31) です。
|
関連項目
someBirthday with parameters year (1974), month (10 = November), day (30), hour (1) and minute (20). The getUTCDate() method is then called, which retrieves the day of the month, according to the UTC. var someBirthday:Date = new Date(1974, 10, 30, 1, 20); trace(someBirthday); // Sat Nov 30 01:20:00 GMT-0800 1974 trace(someBirthday.getUTCDate()); // 30
| getUTCDay | () | メソッド |
AS3 function getUTCDay():Number
この Date
の曜日 (日曜日は 0、月曜日は 1 など) を世界時 (UTC) で返します。
Number —
Date オブジェクトが表す UTC の曜日 (0 ~ 6) です。
|
関連項目
weekDayLabels, with elements [Sunday,Monday,Tuesday,Wednesday,Thursday,Friday,Saturday] and a new Date object someBirthday with parameters year (1974), month (10 = November), day (30), hour (1) and minute (20). The getUTCDay() method is then called twice, which first shows the day of the month as 6 and then shows the day of the week using weekDayLabels, according to the UTC.
var weekDayLabels:Array = new Array("Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday");
var someBirthday:Date = new Date(1974, 10, 30, 1, 20); trace(someBirthday); // Sat Nov 30 01:20:00 GMT-0800 1974 trace(someBirthday.getUTCDay()); // 6 trace(weekDayLabels[someBirthday.getUTCDay()]); // Saturday
| getUTCFullYear | () | メソッド |
AS3 function getUTCFullYear():Number
Date オブジェクトの 4 桁の年を世界時 (UTC) で返します。
Number —
Date オブジェクトが表す UTC の 4 桁の年です。
|
関連項目
someBirthday with parameters year (1974), month (10 = November), day (30), hour (1) and minute (20). The getUTCFullYear() method is then called, which retrieves the four-digit year, according to the UTC. var someBirthday:Date = new Date(1974, 10, 30, 1, 20); trace(someBirthday); // Sat Nov 30 01:20:00 GMT-0800 1974 trace(someBirthday.getUTCFullYear()); // 1974
| getUTCHours | () | メソッド |
AS3 function getUTCHours():Number
Date オブジェクトの時 (0 ~ 23 の整数) を世界時 (UTC) で返します。
Number —
Date オブジェクトが表す UTC の時 (0 ~ 23) です。
|
関連項目
someBirthday with parameters year (1974), month (10 = November), day (30), hour (1) and minute (20). The getHours() and getMinutes() methods are then called, which retrieves the hours and the minutes in 24-hour format. Finally, a string localTime is created and assigned to the result of a call to the function getUSClockTime(), which, in turn calls getHours() and getMinutes() again, resulting in the time 03:05 PM. Lastly, a String variable utcTime is created in the same manner as localTime, and in this case, the result is the same.
var someBirthday:Date = new Date(1974, 10, 30, 15, 5);
trace(someBirthday); // Sat Nov 30 15:20:00 GMT-0800 1974 trace(someBirthday.getHours() + ":" + someBirthday.getMinutes()); // 15:5
var localTime:String = getUSClockTime(someBirthday.getHours(), someBirthday.getMinutes()); trace(localTime); // 03:05 PM
var utcTime:String = getUSClockTime(someBirthday.getUTCHours(), someBirthday.getUTCMinutes()); trace(utcTime); // 11:05 PM
function getUSClockTime(hrs:uint, mins:uint):String { var modifier:String = "PM"; var minLabel:String = doubleDigitFormat(mins);
if(hrs > 12) { hrs = hrs-12; } else if(hrs == 0) { modifier = "AM"; hrs = 12; } else if(hrs < 12) { modifier = "AM"; }
return (doubleDigitFormat(hrs) + ":" + minLabel + " " + modifier); }
function doubleDigitFormat(num:uint):String { if(num < 10) { return ("0" + num); } return num; }
| getUTCMilliseconds | () | メソッド |
AS3 function getUTCMilliseconds():Number
Date オブジェクトのミリ秒 (0 ~ 999 の整数) 部分を世界時 (UTC) で返します。
Number —
Date オブジェクトの UTC のミリ秒部分です。
|
now with no parameters. The getUTCMilliseconds() method is then called, which retrieves the milliseconds of the Date object now at the time it was created, according to the UTC var now:Date = new Date(); trace(now.getUTCMilliseconds());
| getUTCMinutes | () | メソッド |
AS3 function getUTCMinutes():Number
Date オブジェクトの分 (0 ~ 59 の整数) 部分を世界時 (UTC) で返します。
Number —
Date オブジェクトの UTC の分部分です。
|
now with no parameters. The getUTCMinutes() method is then called, which retrieves the minutes of the Date object now at the time it was created, according to the UTC var now:Date = new Date(); trace(now.getUTCMinutes());
| getUTCMonth | () | メソッド |
AS3 function getUTCMonth():Number
Date オブジェクトの月 (0 [1 月] ~ 11 [12 月]) 部分を世界時 (UTC) で返します。
Number —
Date オブジェクトの UTC の月部分です。
|
関連項目
monthLabels, with elements January through December and a new Date object now with no parameters. The getUTCMonth() method is then called twice, which first returns the month number and then the month name of the month the Date object now was created, according to the UTC
var monthLabels:Array = new Array("January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December");
var now:Date = new Date(); trace(now.getMonth()); trace(now.getUTCMonth()); trace(monthLabels[now.getUTCMonth()]);
| getUTCSeconds | () | メソッド |
AS3 function getUTCSeconds():Number
Date オブジェクトの秒 (0 ~ 59 の整数) 部分を世界時 (UTC) で返します。
Number —
Date オブジェクトの UTC の秒部分です。
|
now with no parameters. The getUTCSeconds() method is then called, which retrieves the seconds of the Date object now at the time it was created, according to the UTC var now:Date = new Date(); trace(now.getUTCSeconds());
| parse | () | メソッド |
public static function parse(date:String):Number日付を表すストリングを、1970 年 1 月 1 日 (UTC) から経過したミリ秒数に相当する数値に変換します。
パラメータdate:String — Date.toString() の出力形式に準じた日付のストリング表現です。Date.toString() の出力の日付形式は、次のとおりです。
Day Mon DD HH:MM:SS TZD YYYY
たとえば、次のようになります。
Wed Apr 12 15:30:17 GMT-0700 2006
タイムゾーン指定 (TZD) は、常に
MM/DD/YYYY HH:MM:SS TZD
HH:MM:SS TZD Day Mon/DD/YYYY
Mon DD YYYY HH:MM:SS TZD
Day Mon DD HH:MM:SS TZD YYYY
Day DD Mon HH:MM:SS TZD YYYY
Mon/DD/YYYY HH:MM:SS TZD
YYYY/MM/DD HH:MM:SS TZD
|
Number —
1970 年 1 月 1 日 (UTC) から経過したミリ秒数を表す数値です。
|
関連項目
dateParsed for November 30, 1974. The Date.parse() method is then called, which converts the date into milliseconds since January 1, 1970. var dateParsed:String = "Sat Nov 30 1974"; var milliseconds:Number = Date.parse(dateParsed); trace(milliseconds); // 155030400000
| setDate | () | メソッド |
AS3 function setDate(day:Number):Number月内の日付をローカル時間で設定し、新しい時刻をミリ秒で返します。ローカル時間は、Flash Player を実行しているオペレーティングシステムによって決まります。
パラメータday:Number — 1 ~ 31 の整数です。
|
Number —
ミリ秒で表される新しい時刻です。
|
someBirthday with parameters year (1974), month (10 = November), day (30), hour (1) and minute (20). The method getDate() is then called, which retrieves the day of the month. Next setDate() is called with the day parameter set to 20 and then getDate() is called again, which retrieves the newly set day of month. var someBirthday:Date = new Date(1974, 10, 30, 1, 20); trace(someBirthday); // Sat Nov 30 01:20:00 GMT-0800 1974 trace(someBirthday.getDate()); // 30 someBirthday.setDate(20); trace(someBirthday.getDate()); // 20
| setFullYear | () | メソッド |
AS3 function setFullYear(year:Number, month:Number, day:Number):Number
年をローカル時間で設定し、新しい時刻をミリ秒で返します。month パラメータと day パラメータを指定すると、両方はローカル時間に設定されます。ローカル時間は、Flash Player を実行しているオペレーティングシステムによって決まります。
このメソッドを呼び出しても Date オブジェクトの他のフィールドは変更されませんが、このメソッドを呼び出した結果として曜日が変わった場合には、Date.getUTCDay() と Date.getDay() は新しい値を返すことがあります。
year:Number — 年を示す 4 桁の数値です。2 桁の数値は 4 桁の年の省略形を表しません。たとえば、99 は 1999 年ではなく、99 年です。
|
|
month:Number — 0 (1 月) ~ 11 (12 月) の整数です。
|
|
day:Number — 1 ~ 31 の数値です。
|
Number —
ミリ秒で表される新しい時刻です。
|
関連項目
someBirthday with parameters year (1974), month (10 = November), day (30), hour (1) and minute (20). The method getFullYear() is then called, which retrieves the four-digit year. Next setFullYear() is called with the year parameter set to 2000 and then getFullYear() is called again, which retrieves the newly set year. var someBirthday:Date = new Date(1974, 10, 30, 1, 20); trace(someBirthday); // Sat Nov 30 01:20:00 GMT-0800 1974 trace(someBirthday.getFullYear()); // 1974 someBirthday.setFullYear(2000); trace(someBirthday.getFullYear()); // 2000
| setHours | () | メソッド |
AS3 function setHours(hour:Number, minute:Number, second:Number, millisecond:Number):Number時をローカル時間で設定し、新しい時刻をミリ秒で返します。ローカル時間は、Flash Player を実行しているオペレーティングシステムによって決まります。
パラメータhour:Number — 0 (0 時) ~ 23 (午後 11 時) の整数です。
|
|
minute:Number — 0 ~ 59 の整数です。
|
|
second:Number — 0 ~ 59 の整数です。
|
|
millisecond:Number — 0 ~ 999 の整数です。
|
Number —
ミリ秒で表される新しい時刻です。
|
someBirthday with parameters year (1974), month (10 = November), day (30), hour (1) and minute (20). The methods getHours() and getMinutes() are then called, which retrieves the hours and minutes. Next setHours() is called with the hour parameter set to 12 and then getHours() and getMinutes() are called again, which retrieves the newly set hours and minutes. var someBirthday:Date = new Date(1974, 10, 30, 15, 20); trace(someBirthday); // Sat Nov 30 15:20:00 GMT-0800 1974 trace(someBirthday.getHours() + ":" + someBirthday.getMinutes()); // 15:20 someBirthday.setHours(12); trace(someBirthday.getHours() + ":" + someBirthday.getMinutes()); // 12:20
| setMilliseconds | () | メソッド |
AS3 function setMilliseconds(millisecond:Number):Numberミリ秒をローカル時間で設定し、新しい時刻をミリ秒で返します。ローカル時間は、Flash Player を実行しているオペレーティングシステムによって決まります。
パラメータmillisecond:Number — 0 ~ 999 の整数です。
|
Number —
ミリ秒で表される新しい時刻です。
|
now with no parameters. The method getMilliseconds() is then called, which retrieves the milliseconds when now was created. Then another new Date object before with an additional call to setMilliseconds() with the millisecond parameter set to 4 and getMilliseconds() is called again, which retrieves the newly set milliseconds. var now:Date = new Date(); trace(now); trace(now.getMilliseconds()); var before:Date = new Date(now.setMilliseconds(4)); trace(before); trace(before.getMilliseconds());
| setMinutes | () | メソッド |
AS3 function setMinutes(minute:Number, second:Number, millisecond:Number):Number分をローカル時間で設定し、新しい時刻をミリ秒で返します。ローカル時間は、Flash Player を実行しているオペレーティングシステムによって決まります。
パラメータminute:Number — 0 ~ 59 の整数です。
|
|
second:Number — 0 ~ 59 の整数です。
|
|
millisecond:Number — 0 ~ 999 の整数です。
|
Number —
ミリ秒で表される新しい時刻です。
|
now with no parameters. The method getMinutes() is then called, which retrieves the minutes when now was created. Then another new Date object before with an additional call to setMinutes() with the minute parameter set to 0 and getMinutes() is called again, which retrieves the newly set minutes. var now:Date = new Date(); trace(now); trace(now.getMinutes()); var before:Date = new Date(now.setMinutes(0)); trace(before); trace(before.getMinutes());
| setMonth | () | メソッド |
AS3 function setMonth(month:Number, day:Number):Number月と、オプションで日付をローカル時間で設定し、新しい時刻をミリ秒で返します。ローカル時間は、Flash Player を実行しているオペレーティングシステムによって決まります。
パラメータmonth:Number — 0 (1 月) ~ 11 (12 月) の整数です。
|
|
day:Number — 1 ~ 31 の整数です。
|
Number —
ミリ秒で表される新しい時刻です。
|
monthLabels, with elements January through December and a new month object now with no parameters. The method getMonth() is then called, which retrieves the month in which now was created. Next setMonth() is called with the month parameter set to 0 and then getMonth() is called again, which retrieves the newly set month..
var monthLabels:Array = new Array("January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December");
var now:Date = new Date(); trace(now.getMonth()); trace(monthLabels[now.getMonth()]);
now.setMonth(0); trace(now.getMonth()); // 0 trace(monthLabels[now.getMonth()]); // January
| setSeconds | () | メソッド |
AS3 function setSeconds(second:Number, millisecond:Number):Number秒をローカル時間で設定し、新しい時刻をミリ秒で返します。ローカル時間は、Flash Player を実行しているオペレーティングシステムによって決まります。
パラメータsecond:Number — 0 ~ 59 の整数です。
|
|
millisecond:Number — 0 ~ 999 の整数です。
|
Number —
ミリ秒で表される新しい時刻です。
|
now with no parameters. The method getseconds() is then called, which retrieves the seconds when now was created. Then the setSeconds() is called with the second parameter set to 0 and getSeconds() is called again, which retrieves the newly set seconds. var now:Date = new Date(); trace(now.getSeconds()); now.setSeconds(0); trace(now.getSeconds()); // 0
| setTime | () | メソッド |
AS3 function setTime(millisecond:Number):Number日付を 1970 年 1 月 1 日 0 時からのミリ秒数で設定し、新しい時刻をミリ秒で返します。
パラメータmillisecond:Number — 整数値です。0 は世界時 (UTC) の 1 月 1 日 0 時です。
|
Number —
ミリ秒で表される新しい時刻です。
|
now with no parameters. The setTime() method is then called, with the millisecond parameter set to -1292601600000, which sets the time to Tue Jan 15 00:00:00 GMT-0800 1929. var now:Date = new Date(); trace(now); now.setTime(-1292601600000); trace(now); // Tue Jan 15 00:00:00 GMT-0800 1929
| setUTCDate | () | メソッド |
AS3 function setUTCDate(day:Number):Number
月内の日付を世界時 (UTC) で設定し、新しい時刻をミリ秒で返します。このメソッドを呼び出しても、Date
オブジェクトの他のフィールドは変更されませんが、このメソッドを呼び出した結果として曜日が変わった場合には、Date.getUTCDay() メソッドと Date.getDay() メソッドは新しい値を返すことがあります。
day:Number — 1 ~ 31 の整数値です。
|
Number —
ミリ秒で表される新しい時刻です。
|
関連項目
someBirthday with parameters year (1974), month (10 = November), day (30), hour (1) and minute (20). The method getUTCDate() is called and correctly returns the day of the month. Next setUTCDate() is called with the day parameter set to 1 and a trace() statement confirms the date was correctly set. var someBirthday:Date = new Date(1974, 10, 30, 1, 20); trace(someBirthday); // Sat Nov 30 01:20:00 GMT-0800 1974 trace(someBirthday.getUTCDate()); // 30 someBirthday.setUTCDate(1); trace(someBirthday); // Fri Nov 1 01:20:00 GMT-0800 1974
| setUTCFullYear | () | メソッド |
AS3 function setUTCFullYear(year:Number, month:Number, day:Number):Number年を世界時 (UTC) で設定し、新しい時刻をミリ秒で返します。
このメソッドでは、オプションで月と日を設定することもできます。このメソッドを呼び出しても他のフィールドは変更されませんが、このメソッドを呼び出した結果として曜日が変わった場合には、Date.getUTCDay() と Date.getDay() メソッドは新しい値を返すことがあります。
year:Number — 4 桁の年 (2000 など) を表す整数です。
|
|
month:Number — 0 (1 月) ~ 11 (12 月) の整数です。
|
|
day:Number — 1 ~ 31 の整数です。
|
Number —
整数です。
|
関連項目
someBirthday with parameters year (1974), month (10 = November), day (30), hour (1) and minute (20). The method getUTCFullYear() is called and correctly returns the four-digit year. Next setUTCFullYear() is called with the year parameter set to 1975 and a trace() statement confirms the year was correctly set. var someBirthday:Date = new Date(1974, 10, 30, 1, 20); trace(someBirthday); // Sat Nov 30 01:20:00 GMT-0800 1974 trace(someBirthday.getUTCFullYear()); // 1974 someBirthday.setUTCFullYear(1975); trace(someBirthday); // Thu Nov 30 01:20:00 GMT-0800 1975
| setUTCHours | () | メソッド |
AS3 function setUTCHours(hour:Number, minute:Number, second:Number, millisecond:Number):Number時を世界時 (UTC) で設定し、新しい時刻をミリ秒で返します。オプションで、分、秒、およびミリ秒を指定することができます。
パラメータhour:Number — 0 (0 時) ~ 23 (午後 11 時) の整数です。
|
|
minute:Number — 0 ~ 59 の整数です。
|
|
second:Number — 0 ~ 59 の整数です。
|
|
millisecond:Number — 0 ~ 999 の整数です。
|
Number —
ミリ秒で表される新しい時刻です。
|
someBirthday with parameters year (1974), month (10 = November), day (30), hour (1) and minute (20). The methods getHours(), getMinutes(), getUTCHours(), and getUTCMinutes() are then called, which retrieves the hours and minutes. Next setUTCHours() is called with the hour parameter set to 12 and then the methods getHours(), getMinutes(), getUTCHours(), and getUTCMinutes() are re-called and correctly display the updated hour. var someBirthday:Date = new Date(1974, 10, 30, 15, 20); trace(someBirthday); // Sat Nov 30 15:20:00 GMT-0800 1974 trace(someBirthday.getHours() + ":" + someBirthday.getMinutes()); // 15:20 trace(someBirthday.getUTCHours() + ":" + someBirthday.getUTCMinutes()); // 23:20 someBirthday.setUTCHours(12); trace(someBirthday.getHours() + ":" + someBirthday.getMinutes()); // 4:20 trace(someBirthday.getUTCHours() + ":" + someBirthday.getUTCMinutes()); // 12:20
| setUTCMilliseconds | () | メソッド |
AS3 function setUTCMilliseconds(millisecond:Number):Numberミリ秒を世界時 (UTC) で設定し、新しい時刻をミリ秒で返します。
パラメータmillisecond:Number — 0 ~ 999 の整数です。
|
Number —
ミリ秒で表される新しい時刻です。
|
now with no parameters. The method getUTCMilliseconds() is then called, which retrieves the UTCMilliseconds when now was created. Then another new Date object before with an additional call to setUTCMilliseconds() with the millisecond parameter set to 4 and getUTCMilliseconds() is called again, which retrieves the newly set milliseconds. var now:Date = new Date(); trace(now); trace(now.getUTCMilliseconds()); var before:Date = new Date(now.setUTCMilliseconds(4)); trace(before); trace(before.getUTCMilliseconds());
| setUTCMinutes | () | メソッド |
AS3 function setUTCMinutes(minute:Number, second:Number, millisecond:Number):Number分を世界時 (UTC) で設定し、新しい時刻をミリ秒で返します。オプションで、秒とミリ秒を指定することができます。
パラメータminute:Number — 0 ~ 59 の整数です。
|
|
second:Number — 0 ~ 59 の整数です。
|
|
millisecond:Number — 0 ~ 999 の整数です。
|
Number —
ミリ秒で表される新しい時刻です。
|
now with no parameters. The method getUTCMinutes() is then called, which retrieves the UTCMinutes when now was created. Then another new Date object before with an additional call to setUTCMinutes() with the minute parameter set to 0 and getUTCMinutes() is called again, which retrieves the newly set minutes. var now:Date = new Date(); trace(now); trace(now.getUTCMinutes()); var before:Date = new Date(now.setUTCMinutes(0)); trace(before); trace(before.getUTCMinutes());
| setUTCMonth | () | メソッド |
AS3 function setUTCMonth(month:Number, day:Number):Number
月、およびオプションで日を世界時 (UTC) で設定し、新しい時刻をミリ秒で返します。このメソッドを呼び出しても他のフィールドは変更されませんが、このメソッドを呼び出した結果として曜日が変わった場合には、Date.getUTCDay() メソッドと Date.getDay() メソッドは新しい値を返すことがあります。
month:Number — 0 (1 月) ~ 11 (12 月) の整数です。
|
|
day:Number — 1 ~ 31 の整数です。
|
Number —
ミリ秒で表される新しい時刻です。
|
関連項目
UTCMonthLabels, with elements January through December and a new UTCMonth object now with no parameters. The method getUTCMonth() is then called, which retrieves the UTCMonth in which now was created. Next setUTCMonth() is called with the month parameter set to 0 and then getUTCMonth() is called again, which retrieves the newly set month..
var UTCMonthLabels:Array = new Array("January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December");
var now:Date = new Date(); trace(now.getUTCMonth()); trace(UTCMonthLabels[now.getUTCMonth()]);
now.setUTCUTCMonth(0); trace(now.getUTCMonth()); // 0 trace(UTCMonthLabels[now.getUTCMonth()]); // January
| setUTCSeconds | () | メソッド |
AS3 function setUTCSeconds(second:Number, millisecond:Number):Number秒、およびオプションでミリ秒を世界時 (UTC) で設定し、新しい時刻をミリ秒で返します。
パラメータsecond:Number — 0 ~ 59 の整数です。
|
|
millisecond:Number — 0 ~ 999 の整数です。
|
Number —
ミリ秒で表される新しい時刻です。
|
now with no parameters. The method getUTCSeconds() is then called, which retrieves the seconds when now was created. Then the setUTCSeconds() is called with the second parameter set to 0 and getUTCSeconds() is called again, which retrieves the newly set seconds. var now:Date = new Date(); trace(now.getUTCSeconds()); now.setUTCSeconds(0); trace(now.getUTCSeconds()); // 0
| toDateString | () | メソッド |
AS3 function toDateString():String曜日と日付のみのストリング表現を返します。時刻またはタイムゾーンは含まれません。次のメソッドと対照を成します。
Date.toTimeString() は時刻とタイムゾーンのみを返します。Date.toString() は曜日と日付のみでなく、時刻とタイムゾーンも返します。String —
曜日と日付のみのストリング表現です。
|
関連項目
now with no parameters and then the following methods are called within a trace() statement toString: displays all parameters for now at the time now was created.toDateString(): displays the day, month, and year parameters for the time now was created.var now:Date = new Date(); trace(now); trace(now.toDateString());
| toLocaleDateString | () | メソッド |
AS3 function toLocaleDateString():String
曜日と日付のみのストリング表現を返します。時刻またはタイムゾーンは含まれません。このメソッドは、Date.toDateString と同じ値を返します。次のメソッドと対照を成します。
Date.toTimeString() は時刻とタイムゾーンのみを返します。Date.toString() は曜日と日付のみでなく、時刻とタイムゾーンも返します。String —
曜日と日付のみの String 表現です。
|
関連項目
| toLocaleString | () | メソッド |
AS3 function toLocaleString():String
曜日、日付、時刻のストリング表現を、指定されたローカル時間で返します。同じ情報 (およびタイムゾーン) をストリングの最後に年を付けて返す Date.toString() メソッドと対照を成します。
String —
Date オブジェクトのストリング表現をローカルタイムゾーンで返します。
|
| toLocaleTimeString | () | メソッド |
AS3 function toLocaleTimeString():String
時刻のみのストリング表現を返します。曜日、日付、年、またはタイムゾーンは含まれません。時刻とタイムゾーンを返す Date.toTimeString() メソッドと対照を成します。
String —
時刻とタイムゾーンのみのストリング表現です。
|
関連項目
| toString | () | メソッド |
AS3 function toString():String曜日、日付、時刻、およびタイムゾーンのストリング表現を返します。出力の日付形式は、次のとおりです。
Day Mon Date HH:MM:SS TZD YYYY
たとえば、次のようになります。
Wed Apr 12 15:30:17 GMT-0700 2006
戻り値
String —
Date オブジェクトのストリング表現です。
|
now with no parameters and then toString is called within a trace() statement, which displays all parameters for now at the time now was created. var now:Date = new Date(); trace(now);
| toTimeString | () | メソッド |
AS3 function toTimeString():String
時刻とタイムゾーンのみのストリング表現を返します。曜日と日付は含まれません。曜日と日付のみを返す Date.toDateString() メソッドと対照を成します。
String —
時刻とタイムゾーンのみのストリング表現です。
|
関連項目
| toUTCString | () | メソッド |
AS3 function toUTCString():String
曜日、日付、および時刻のストリング表現を世界時 (UTC) で返します。たとえば、2005 年 2 月 1 日を Tue Feb 1 00:00:00 2005 UTC として返します。
String —
Date オブジェクトの UTC のストリング表現です。
|
関連項目
| UTC | () | メソッド |
public static function UTC(year:Number, month:Number, date:Number = 1, hour:Number = 0, minute:Number = 0, second:Number = 0, millisecond:Number = 0):Number
1970 年 1 月 1 日 0 時 (世界時) からパラメータで指定された時刻までのミリ秒数を返します。このメソッドでは世界時を使用するのに対し、Date コンストラクタではローカル時間を使用します。
このメソッドは、UTC の日付を Date クラスのコンストラクタに渡す場合に便利です。Date クラスのコンストラクタはミリ秒オフセットを引数として受け取るため、Date.UTC() メソッドを使用して UTC の日付を対応のミリ秒オフセットに変換し、このオフセットを引数として Date クラスコンストラクタに送ることができます。
パラメータyear:Number — 年を表す 4 桁の整数 (2000 など) です。
|
|
month:Number — 0 (1 月) ~ 11 (12 月) の整数です。
|
|
date:Number (default = 1) — 1 ~ 31 の整数です。
|
|
hour:Number (default = 0) — 0 (0 時) ~ 23 (午後 11 時) の整数です。
|
|
minute:Number (default = 0) — 0 ~ 59 の整数です。
|
|
second:Number (default = 0) — 0 ~ 59 の整数です。
|
|
millisecond:Number (default = 0) — 0 ~ 999 の整数です。
|
Number —
1970 年 1 月 1 日から指定された日時までのミリ秒数です。
|
someBirthday with parameters year (1974), month (10 = November), day (30), hour (1) and minute (20) using local time. Then a call to UTC() within a setTime() method resets the same parameters to universal time. var someBirthday:Date = new Date(1974, 10, 30, 15, 20); trace(someBirthday.toString()); someBirthday.setTime(Date.UTC(1974, 10, 30, 15, 20)); trace(someBirthday.toString());
| valueOf | () | メソッド |
AS3 function valueOf():Number
Date オブジェクトの 1970 年 1 月 1 日 0 時 (世界時) からのミリ秒数を返します。
Number —
Date オブジェクトが表す 1970 年 1 月 1 日からのミリ秒数です。
|
now with no parameters The getTime() method is then called, which retrieves the number of milliseconds between the time now was created and midnight on January 1, 1970, and then valueOf() is called, which retrieves the same thing. var now:Date = new Date(); trace(now.getTime()); trace(now.valueOf());
Date() constructor to assign the following variables: myDate1 calls Date() with no parameters, which sets myDate1 to the current date and time (according to your current system's date and time). myDate2 calls Date() with the year (2000), month (0 = January), and day (1) parameters passed to it.myDate3 calls Date() with the year (65 = 1965), month (2 = March), the day (6), the hour (9), the minute (30), the second (15) and the millisecond-+ (0) passed as parameters.myDate4 calls Date() with the time value representing the number of milliseconds before (since the value is negative) 0:00:00 GMT January 1, 1970.
package { import flash.display.Sprite;
public class DateExample extends Sprite{ public function DateExample() { var myDate1:Date = new Date(); trace(myDate1); // [NOW]
var myDate2:Date = new Date(2000, 0, 1); trace(myDate2); // Sat Jan 1 00:00:00 GMT-0800 2000
var myDate3:Date = new Date(65, 2, 6, 9, 30, 15, 0); trace(myDate3); // Sat Mar 6 09:30:15 GMT-0800 1965
var myDate4:Date = new Date(-14159025000); trace(myDate4); // Sun Jul 20 19:56:15 GMT-0700 1969 } } }