Python time ctime()メソッド


説明

Python time ctime() 関数は、タイムスタンプ(秒単位の浮動小数点数)を time.asctime() の形式に変換します。パラメータが指定されていない場合、または None の場合、デフォルトで time.time() がパラメータとして使用されます。これは asctime(localtime(secs)) と同等です。

構文

ctime()メソッドの構文:

time.ctime([ sec ])

パラメータ

  • sec -- 文字列時間に変換する秒数。

戻り値

この関数は戻り値を返しません。

例

以下の例は、ctime() 関数の使用方法を示しています:

#!/usr/bin/python
import time

print "time.ctime() : %s" % time.ctime()

上記の例の出力結果は次のとおりです:

time.ctime() : Tue Feb 17 10:00:18 2013
その他の拡張