Next: Errors, Previous: Control Flow, Up: Top
k9 has functions (within .z
) to get the current date and time to various degrees of precision. There are also functions to retrieve partial date and time using dot notation.
date 2001.01.01 .z.d time 12:34:56.789 .z.t
These functions retrieve the date as day (d) or month (m) precision.
.z.d 2020.12.13 .z.m 2020.12.
These functions retrieve the time at hour (h), minute (r), second (s), millisecond (t), microsecond (u), or nanosecond (v) precision.
.z.h 11 .z.r 11:25 .z.s 11:25:16 .z.t 11:25:16.842 .z.u 11:25:17.491362 .z.v 11:25:18.186360064
One could use the current time commands to measure run time but typically this is done via \t
t1:.z.v;(_2e8)rand 1.;t2:.z.v;t2-t1 00:00:00.609207008 \t (_2e8)rand 1. 610
These functions use dot notation to retrieve partial date and times.
now:.z.v;now 11:27:18.049558016 now.h 11 now.r 11:27 now.s 11:27:18 now.t 11:27:18.049 now.u 11:27:18.049558 now.v 11:27:18.049558016