Search code examples
unix-timestampconky

In Conky, how do I convert from Unix time to hours and minutes? (HH:MM)


Given a Unixtime such as 1551996855 (Thu, 07 Mar 2019 22:14:15 +0000), how can convert and extract just HH:MM, (22:14)?


Solution

  • you could use date for the conversion and specify +%H:%M as the format:

    date -d @$"1551996855" +%H:%M
    
    • note: the option to use with date will be different than -d if you are not on a Linux system (which uses date from GNU coreutils).. so YMMV