ジャンプ先: 概要. 戻り値. キーワード. フラグ. Python 例.
date([date=boolean], [format=string], [shortDate=boolean], [shortTime=boolean], [time=boolean])
注: オブジェクトの名前と引数を表す文字列は、カンマで区切る必要があります。これはシノプシスに示されていません。
date は、取り消し不可能、照会不可能、および編集不可能です。
現在のタイムと日付の情報を返します。定義済みフォーマットまたは -format フラグで出力フォーマットを指定します。
time, date
date, format, shortDate, shortTime, time
ロング ネーム(ショート ネーム) |
引数タイプ |
プロパティ |
time(t)
|
boolean
|
|
|
現在のタイムを返します。フォーマットは hh:mm:ss です。
|
|
shortTime(st)
|
boolean
|
|
|
現在のタイムを返します。フォーマットは hh:mm です。
|
|
date(d)
|
boolean
|
|
|
現在の日付を返します。フォーマットは YYYY/MM/DD です。
|
|
shortDate(sd)
|
boolean
|
|
|
現在の日付を返します。フォーマットは MM/DD です。
|
|
format(f)
|
string
|
|
|
日付と時間の表示方法を定義する文字列を指定します。以下のキーワードの出現場所は、すべて対応する値に置換されます。
キーワード | 置換後 |
YYYY | 現在の年(4 桁) |
YY | 現在の年(下 2 桁) |
MM | 現在の月。該当する場合、先頭に 0 が追加されます。 |
DD | 現在の日。該当する場合、先頭に 0 が追加されます。 |
hh | 現在の時間。該当する場合、先頭に 0 が追加されます。 |
mm | 現在の分。該当する場合、先頭に 0 が追加されます。 |
ss | 現在の秒。該当する場合、先頭に 0 が追加されます。 |
|
|
フラグはコマンドの作成モードで表示できます
|
フラグはコマンドの編集モードで表示できます
|
フラグはコマンドの照会モードで表示できます
|
フラグに複数の引数を指定し、タプルまたはリストとして渡すことができます。
|
import maya.cmds as cmds
# Get the current date and time
cmds.date()
# Result:2006/03/09 16:50:24 #
# Get only the month and day
cmds.date( shortDate=True )
# Result:03/09 #
# Get the date and time in a fancy format
cmds.date( format='Year is YY (or YYYY), month is MM, day is DD. And it is now hh:mm:ss' )
# Result:Year is 06 (or 2006), month is 03, day is 09. And it is now 16:53:20 #