简体   繁体   中英

Linux: How to display the date in a different time format using the last command in terminal?

I am trying to display just the time of the last logon of a user.

The goal is to display the time just like

date "+d% %B%t%Y"

would.

I tried:

last -n1 --time-format "+d% %B%t%Y"

but it keeps telling me that it is an unknown time format. I also tried the ones in the man last examples, none of those formats seem to work. Is there another way of doing this?

The --time-format option only accepts the following options:

--time-format <format>  show timestamps in the specified <format>:
                               notime|short|full|iso

You might have to parse the datetime yourself, for example from ISO format.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM