; ; @ANO_SCRIPT_NAME time_format ; @ANO_SCRIPT_VERSION 0.0.1 ; @ANO_SCRIPT_DESCRIPTION Simple time/date conversion example ; ; @ANO_FLAGS_USE_PROTOS [ ] ; @ANO_FLAGS_VAR_NAME_SUBS [ ] ; @ANO_FLAGS_VAR_WARN_UNUSED [ ] ; ; Copyright (c) 2016-2026, Jani Salonen ; All rights reserved. ; ; This is just silly example to fiddle with numbers and timestamps. ; main [exit: 0] { mov _birth ("1974-09-21") ; Get current time formatted as ISO-8601. ; _t = time _n = time_strfmt (\ time: _t, \ format: "%Y-%m-%dT%H:%M:%S") print "This moment is: " . _n . "\n" ; Convert two timestamps to seconds since epoch... ; _a = time_fmtstr (\ time: _n, \ format: "%Y-%m-%dT%H:%M:%S") _b = time_fmtstr (\ time: _birth, \ format: "%Y-%m-%d") ; ...get the difference in secs... ; _c = time_diff (\ time_a: _a, \ time_b: _b) ; ...and convert the difference into date. ; _d = time_strfmt (\ time: _c, \ format: "%Y-%m-%dT%H:%M:%S") print "Difference between " . _birth . " and this moment is " . _c . \ " seconds,\nas formatted date since system epoch: " . _d . "\n" }