Zsh command: strftime not found

I am currently researching zsh and now I wanted to use strftime

, but I get:

zsh: command not found: strftime

I think I am doing something wrong as I see people using this function all the time in their dot files.

+2


a source to share


2 answers


strftime

is defined in a module zsh

called datetime

. The command zmodload

loads modules from a colon-separated list of directories into $module_path

.

On my system:



% echo $module_path
/usr/lib/zsh/4.3.10
% ls -l $module_path
drwxr-xr-x 3 root root 4096 2009-11-05 01:03 zsh
% ls -l $module_path/zsh/datetime*
-rw-r--r-- 1 root root 9828 2009-09-10 02:45 /usr/lib/zsh/4.3.10/zsh/datetime.so
% type -a strftime
strftime not found
% zmodload zsh/datetime
% strftime %Y-%m-%d 1271603087
2010-04-18
% type -a strftime
strftime is a shell builtin
% /bin/date -d @1271603087 +%Y-%m-%d
2010-04-18

      

+4


a source


strftime

is a C function, I believe it date

has all the same functionality on the command line.

For details see man date

.



One uses a parameter --date=STRING

to specify a date for formatting instead of getting the current time.

+1


a source







All Articles