移動先: 概要 戻り値 キーワード. フラグ. Python 例.

概要

date([date=boolean], [format=string], [shortDate=boolean], [shortTime=boolean], [time=boolean])

注意: オブジェクト名や引数を表す文字列はカンマで区切ります。これは概要には示されていません。

date は 「元に戻す」が不可能「照会」が不可能「編集」が不可能 です。

カレント タイムと日付の情報を返します。定義済みフォーマットまたは -format フラグで出力フォーマットを指定します。

戻り値

string

キーワード

time, date

フラグ

date, format, shortDate, shortTime, time
ロング ネーム(ショート ネーム) 引数型 プロパティ
time(t) boolean create
カレント タイムを返します。フォーマットは hh:mm:ss です。
shortTime(st) boolean create
カレント タイムを返します。フォーマットは hh:mm です。
date(d) boolean create
カレントの日付を返します。フォーマットは YYYY/MM/DD です。
shortDate(sd) boolean create
カレントの日付を返します。フォーマットは MM/DD です。
format(f) string create
日付と時間の表示方法を定義する文字列を指定します。以下のキーワードの出現場所は、すべて対応する値に置換されます。 YYYYYYMMDDhhmmss
キーワード置換後
カレントの年(4 桁)
カレントの年(下 2 桁)
カレントの月。該当する場合、先頭に 0 が追加されます。
カレントの日。該当する場合、先頭に 0 が追加されます。
カレントの時間。該当する場合、先頭に 0 が追加されます。
カレントの分。該当する場合、先頭に 0 が追加されます。
カレントの秒。該当する場合、先頭に 0 が追加されます。

: コマンドの作成モードで使用可能なフラグ : コマンドの編集モードで使用可能なフラグ
: コマンドの照会モードで使用可能なフラグ : タプルまたはリストとして渡された複数の引数を持てるフラグ

Python 例

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 #