日時

日時のサンプルです。
os.date()でそのままの形式で出力。
os.date("%Y-%m-%d %H:%M:%S")で整形したしたものを出力。
os.time()でそのままの形式で出力。
MicroLuaのサンプルtimersも参考になります。

-- DateTime datetime.lua
 
DateTime = {}
 
while not Keys.newPress.Start do
	Controls.read()
	startDrawing()
 
	screen.print(SCREEN_UP, 0, 8 * 1, os.date())
	screen.print(SCREEN_UP, 0, 8 * 6, os.date("%Y-%m-%d %H:%M:%S"))
	screen.print(SCREEN_UP, 0,  8 * 10, os.time())
 
	screen.print(SCREEN_DOWN, 0, 8 * 10, "Press START to quit")
 
	stopDrawing()
end
 

実行結果






タグ:

+ タグ編集
  • タグ:
最終更新:2010年10月08日 10:41
ツールボックス

下から選んでください:

新しいページを作成する
ヘルプ / FAQ もご覧ください。
添付ファイル