@TIMEDIFF
— subtracts one
time from another and returns the difference.
Syntax:
%@TIMEDIFF[
time1,
time2,
infmt,
tfmt]
%@TIMEDIFF[
date1@
time1,
date2@
time2,
infmt,
tfmt]
time1 | the time to subtract from time2 |
date1@ time1 | you can also give a time on a specific date |
time2 | if not specified, defaults to the current time |
date2@ time2 | you can also give a time on a specific date |
infmt | the input date format, used to interpret ambiguous dates |
tfmt | the format in which to return the time difference; defaults to 128 (24-hour with seconds) |
You can specify date-time pairs for the starting and ending times. The date
may be in any format supported by this plugin. Separate
the date from the time with an @
sign or the letter T
.
The tfmt parameter controls the display of the time difference. It’s a subset of the usual time display formats; all of the 12-hour options are disabled because they make no sense here. You can specify 0 to return only hours and minutes; add 128 to include seconds; add 256 to include milliseconds; or add 1024 or 2048 to left-pad the hours field with zeros or spaces, respectively. You can also specify format 15 to return the time difference as a fraction of a day.
The difference between the two times will be reported as a positive value, regardless of whether time1 is before or after time2.
rem How long until 8 o'clock Christmas morning?
echo %@timediff[%@nextdate[12,25]@8:00]
• New: This function does not exist in Take Command.