Dates and times

To get the basic time information, you can use the time() function that returns, for example, 1.408719961424e9, the number of seconds since a predefined date called the epoch (normally, the 1st of January 1970 on Unix system), This is useful for measuring the time interval between two events, for example, to benchmark how long a long calculation takes:

start_time = time()
# long computation
time_elapsed = time() - start_time
println("Time elapsed: $time_elapsed")

Most useful function is strftime(time()) that returns a string in "22/08/2014 17:06:13" format.

If you want more functionality greater than equal to 0.3 when working in Julia, take a look at the Dates package. Add this to the environment with Pkg.add("Dates") (it provides ...

Get Julia: High Performance Programming now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.