Date and time utilities
Various helpful utility functions to deal with time and dates.
# Time and Date related utilities
function clock void() {
sys { timedate.cpl };
};
function time void() {
local curtime string;
fmtdatetime "%H:%M:%S" curtime;
print "%curtime";
};
function date void() {
local curdate string;
fmtdatetime "%Y-%m-%d" curdate;
print "%curdate";
};
function datetime void() {
local curdatetime string;
fmtdatetime "%Y-%m-%d %H:%M:%S" curdatetime;
print "%curdatetime";
};
function seconds void()
{
local curseconds string;
fmtdatetime "%S" curseconds;
print "%curseconds";
};
function secs void() { call seconds() => void; };
function rsecs void()
{
local curseconds string;
local intsecs int;
fmtdatetime "%S" curseconds;
set intsecs <= %curseconds;
- intsecs 60 %intsecs;
print %intsecs;
};
function weekday void(date string) {
local dayname string;
if (%date, -eq, "") {
fmtdatetime "%Y-%m-%d" date;
};
sys {php -r "echo date('l', strtotime('%date'));"} dayname;
print "%dayname";
};
function synchronize_datetime void()
{
sys {w32tm /resync};
};