Erlang and current time

I want to get the current time with erlang. I tried using the following code:

{{Year,Month,Day},{Hour,Min,Sec}} = erlang:localtime().

But sometimes he received an error, for example, “** exception error: matching the value of the right side {{2012,5,6}, {23,40,58}} '

There seems to be a problem with 1 digit. I'm trying to find a couple of web pages, but still can't find a way to handle this.

I find it pretty simple, but as a newbie to erlang, I can't solve it. I try my best.

Env: Erlang {"OTP APN 181 01", "R15B01"} installed with the binary version of Windows Windows XP

Thanks in advance,

+5
source share
1 answer

, 1 . ( {{Year,Month,Day},{Hour,Min,Sec}} = {{2012,5,6},{23,40,58}}). , - .

+14

All Articles