跳转至

Time time

This section is hidden by default

The time section displays the timestamp of the prompt.

Displaying the section

Set SPACESHIP_TIME_SHOW to true in your .zshrc, if you need to show timestamps:

.zshrc
SPACESHIP_TIME_SHOW=true

Date formatting

You can set custom formatting for the timestamps. To use a 12-hour format just toggle SPACESHIP_TIME_12HOUR to true:

.zshrc
SPACESHIP_TIME_12HR=true

Additionally, you can set virtually any formatting supported by ZSH date formats for the timestamps using SPACESHIP_TIME_FORMAT:

.zshrc
SPACESHIP_TIME_FORMAT='%D{%H:%M:%S.%.}'

Options

Variable Default Meaning
SPACESHIP_TIME_SHOW false Show section (set to true for enabling)
SPACESHIP_TIME_PREFIX at· Section's prefix
SPACESHIP_TIME_SUFFIX $SPACESHIP_PROMPT_DEFAULT_SUFFIX Section's suffix
SPACESHIP_TIME_COLOR yellow Section's color
SPACESHIP_TIME_FORMAT - Custom date formatting
SPACESHIP_TIME_12HR false Format time using 12-hour clock (am/pm)