2011/3/24 Cecil Westerhof
\startluacode function modification_date(file, format) local f = file local attr = lfs.attributes(f)
assert (type(attr) == "table") if attr.mode ~= "directory" then if format == "long" then return os.date("%Y-%m-%d %H:%M",attr.modification) else return os.date("%Y-%m-%d",attr.modification) end end end \stopluacode
I made the code a little better: \startluacode os.setlocale("nl_NL") function modification_date(file, format) local f = file local attr = lfs.attributes(f) local fmt = "%d %B %Y" assert (type(attr) == "table") if attr.mode ~= "directory" then if format == "long" then fmt = fmt .. " %H:%M" end return os.date(fmt,attr.modification) end end \stopluacode There is only one problem. I get: 25 March 2011 instead of: 25 maart 2011 What am I doing wrong? -- Cecil Westerhof