%%
%% The LaTeX Companion, 3ed
%%
%% Example 17-4-2 on page II-619 in "filemod --- Printing or checking file modification dates".
%%
%% Copyright (C) 2022 Frank Mittelbach
%%
%% It may be distributed and/or modified under the conditions
%% of the LaTeX Project Public License, either version 1.3c
%% of this license or (at your option) any later version.
%%
%% See
https://www.latex-project.org/lppl.txt for details.
%%
\documentclass{tlc3exa}
\pagestyle{empty}
\setcounter{page}{6}
\setlength\textwidth{159.0pt}
\setlength\parindent{0pt}
%StartShownPreambleCommands
\usepackage{filemod}
\begin{filecontents}[force]{trial1}
content Trial1 % rewritten always!
\end{filecontents}
\begin{filecontents}{trial2}
content Trial2 % written once!
\end{filecontents}
%StopShownPreambleCommands
\begin{document}
Date: \filemodprintdate{trial1.tex} \\
Time: \filemodprinttime{trial1.tex} \\[10pt]
trial1.tex: \filemodprint{trial1} \\
% second file (written only once):
trial2.tex: \filemodprint{trial2} \\[10pt]
Oldest: \input{\filemodoldest{trial1}{trial2}} \\
Newest: \input{\filemodnewest{trial1}{trial2}}
\end{document}