2011年3月13日日曜日

Erlang time() sample

time() -> {Hour, Minute, Second}
Types:
Hour = Minute = Second = int()

Returns the current time as {Hour, Minute, Second}.
(現在の時間を{Hour, Minute, Second}として返す)

The time zone and daylight saving time correction depend on the underlying OS.
(タイムゾーンとかはOSのものに依存する)



5> {H,M,S} = time().
{11,1,19}
6> io:format(~p時~p分~p秒~n,[H,M,S]).
* 1: illegal character
6> ~p分~p秒~n,[H,M,S]).
* 1: illegal character
6> ~p秒~n,[H,M,S]).
* 1: illegal character
6> ~n,[H,M,S]).
* 1: syntax error before: '~'
6> io:format(~p:~p:~p,[H,M,S]).
* 1: syntax error before: '~'
6> io:format(~p:~p:~p~n,[H,M,S]).
* 1: syntax error before: '~'
6> H
6> .
11
7> io:format("~p:~p:~p~n",[H,M,S]).
11:1:19
ok
8> io:format("~p時~p分~p秒~n",[H,M,S]).
11時1分19秒
ok
9>

0 件のコメント:

コメントを投稿