Current system time in hex
- 23 Mar 2017: Post was created (diff)
Get current system time as HEX string
#!/bin/bash
# Get zero-padded hex string from date format
# Usage: f <format>
function f {
printf %02X $(date +$1)
}
h=$(f %-H)
m=$(f %-M)
s=$(f %-S)
echo $h:$m:$s
Example
$ date && timestring
Thu Mar 23 14:34:02 CET 2017
0E:22:02
If you have any comments or feedback, please send me an e-mail. (stig at stigok dotcom).
Did you find any typos, incorrect information, or have something to add? Then please propose a change to this post.