Python time asctime()メソッド
説明
Python time asctime() 関数は時間タプルを受け取り、「Tue Dec 11 18:07:14 2008」(2008年12月11日 火曜日18時07分14秒)という読み取り可能な形式の24文字の文字列を返します。
構文
asctime()メソッドの構文:
time.asctime([t]))
引数
- t -- 9つの要素からなるタプル、または関数 gmtime() や localtime() によって返される時間値。
戻り値
「Tue Dec 11 18:07:14 2008」(2008年12月11日 火曜日18時07分14秒)という読み取り可能な形式の24文字の文字列を返します。
例
以下の例は、asctime()関数の使用方法を示しています:
#!/usr/bin/python import time t = time.localtime() print "time.asctime(t): %s " % time.asctime(t)
上記の例の出力結果は次のとおりです:
time.asctime(t): Tue Feb 17 09:42:58 2009その他の拡張