I was having trouble to make the following function to work on Linux machines, where +eval feature is found upon calling :version. The error message reads:

E117: Unknown function: strptime

The following function is intended to work with Vimwiki, for looking up a older diary file relative to the current diary-file in the buffer. The same function was working as intended on WSL (on a Windows machine).

function! EnumOlderDates(numdays)
    " Assumes that the current buffer is loaded with a file named as "2021-01-03.md"
    " Open in a new buffer, the "diary file" as old as numdays back
    let l:date_for_this_notebook = expand("%:t:r")
    let l:unix_time_for_this_notebook = strptime("%Y-%m-%d", date_for_this_notebook)
    let l:unix_target_date = unix_time_for_this_notebook - 60*60*24*a:numdays
    " echo strftime("%Y-%m-%d", l:unix_target_date)
    let l:date_for_target = strftime("%Y-%m-%d", l:unix_target_date)
    call vimwiki#diary#make_note(v:count, 0, l:date_for_target)

What I see from :version command in Vim

VIM - Vi IMproved 8.0 (2016 Sep 12, compiled Jun 06 2019 17:31:41)
Included patches: 1-1453
Modified by pkg-vim-maintainers@lists.alioth.debian.org
Compiled by pkg-vim-maintainers@lists.alioth.debian.org
Huge version with GTK2 GUI.  Features included (+) or not (-):
+acl               +cursorshape       +job               -mouse_sysmouse    +scrollbind        +virtualedit
+arabic            +dialog_con_gui    +jumplist          +mouse_urxvt       +signs             +visual
+autocmd           +diff              +keymap            +mouse_xterm       +smartindent       +visualextra
-autoservername    +digraphs          +lambda            +multi_byte        +startuptime       +viminfo
+balloon_eval      +dnd               +langmap           +multi_lang        +statusline        +vreplace
+balloon_eval_term -ebcdic            +libcall           -mzscheme          -sun_workshop      +wildignore
+browse            +emacs_tags        +linebreak         +netbeans_intg     +syntax            +wildmenu
++builtin_terms    +eval              +lispindent        +num64             +tag_binary        +windows
+byte_offset       +ex_extra          +listcmds          +packages          +tag_old_static    +writebackup
+channel           +extra_search      +localmap          +path_extra        -tag_any_white     +X11
+cindent           +farsi             +lua               +perl              +tcl               -xfontset
+clientserver      +file_in_path      +menu              +persistent_undo   +termguicolors     +xim
+clipboard         +find_in_path      +mksession         +postscript        +terminal          +xpm
+cmdline_compl     +float             +modify_fname      +printer           +terminfo          +xsmp_interact
+cmdline_hist      +folding           +mouse             +profile           +termresponse      +xterm_clipboard
+cmdline_info      -footer            +mouseshape        -python            +textobjects       -xterm_save
+comments          +fork()            +mouse_dec         +python3           +timers
+conceal           +gettext           +mouse_gpm         +quickfix          +title
+cryptv            -hangul_input      -mouse_jsbterm     +reltime           +toolbar
+cscope            +iconv             +mouse_netterm     +rightleft         +user_commands
+cursorbind        +insert_expand     +mouse_sgr         +ruby              +vertsplit
   system vimrc file: "$VIM/vimrc"
     user vimrc file: "$HOME/.vimrc"
 2nd user vimrc file: "~/.vim/vimrc"
      user exrc file: "$HOME/.exrc"
  system gvimrc file: "$VIM/gvimrc"
    user gvimrc file: "$HOME/.gvimrc"
2nd user gvimrc file: "~/.vim/gvimrc"
       defaults file: "$VIMRUNTIME/defaults.vim"
    system menu file: "$VIMRUNTIME/menu.vim"
  fall-back for $VIM: "/usr/share/vim"
Compilation: gcc -c -I. -Iproto -DHAVE_CONFIG_H -DFEAT_GUI_GTK  -pthread -I/usr/include/gtk-2.0 -I/usr/lib/x86_64-linux
-gnu/gtk-2.0/include -I/usr/include/gio-unix-2.0/ -I/usr/include/cairo -I/usr/include/pango-1.0 -I/usr/include/atk-1.0
-I/usr/include/cairo -I/usr/include/pixman-1 -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/libpng16 -I/usr/include/pango
-1.0 -I/usr/include/harfbuzz -I/usr/include/pango-1.0 -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/incl
ude -I/usr/include/freetype2 -I/usr/include/libpng16 -I/usr/include/freetype2 -I/usr/include/libpng16 -Wdate-time  -g -
O2 -fdebug-prefix-map=/build/vim-8l5tlu/vim-8.0.1453=. -fstack-protector-strong -Wformat -Werror=format-security -U_FOR


As it turned out, I was running an older version of Vim. Updating using the following "three-liners" solved the problem.

sudo add-apt-repository ppa:jonathonf/vim
sudo apt update
sudo apt install vim vim-gtk3

Not the answer you're looking for? Browse other questions tagged or ask your own question.