Erlang - universaltime



Returns the current date and time according to Universal Time Coordinated (UTC), also called GMT, in the form {{Year, Month, Day}, {Hour, Minute, Second}} if supported by the underlying operating system.

Syntax

universaltime()

Parameters

  • None

Return Value

Returns the current date and time according to Universal Time Coordinated (UTC), also called GMT, in the form {{Year, Month, Day}, {Hour, Minute, Second}} if supported by the underlying operating system.

For example

-module(helloworld). 
-export([start/0]). 

start() -> 
   io:fwrite("~p~n",[erlang:universaltime()]).

Output

When we run the above program we will get the following result. Depending on the system, the output will differ.

{{2016,4,17},{11,51,39}}
erlang_bifs.htm
Advertisements