diff options
| author | jdhao <jdhao@hotmail.com> | 2021-12-02 22:06:40 +0800 |
|---|---|---|
| committer | jdhao <jdhao@hotmail.com> | 2021-12-02 22:06:40 +0800 |
| commit | 39e5e1913f432136b8746d64e37494eefa1f07c8 (patch) | |
| tree | 6c4acbbaa6e1c2ad915105ad6f761a22e54f9acd /autoload | |
| parent | 80ceacbb020edbf17540e5f2d5e5d77781a951c2 (diff) | |
Add command :Datetime to show current time or translate a Unix timestamp
Diffstat (limited to 'autoload')
| -rw-r--r-- | autoload/utils.vim | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/autoload/utils.vim b/autoload/utils.vim index 8486773..d1933a2 100644 --- a/autoload/utils.vim +++ b/autoload/utils.vim @@ -145,8 +145,12 @@ function! utils#Get_titlestr() abort return l:title_str endfunction -" Output current time in ISO format. -function! utils#iso_time() abort +" Output current time or unix timestamp in human-readable format. +function! utils#iso_time(timestamp) abort + if a:timestamp + return strftime('%Y-%m-%d %H:%M:%S%z', a:timestamp) + endif + return strftime('%Y-%m-%d %H:%M:%S%z') endfunction |
