% This file is embedded in datatool-user.pdf version 3.4 2025-04-03
% Example 46 Parsing Dates and Times and Reformatting
% Label: "ex:parsetemporalreformat"
% arara: pdflatex
% arara: pdfcrop
\documentclass[12pt]{article}
\pagestyle{empty}
% This will not only require datetime2.sty to be installed 
 % but also datetime2-english should be installed 
 \usepackage[en-GB]{datetime2}
\usepackage{datatool-base} 
\begin{document}
\DTLsetup{datetime={parse={auto-reformat}}} 

\DTLparse\result{2025-01-09}
String value: \result.
Data type: \DTLdatumtype{\result}.
Value: \DTLdatumvalue{\result}. 

\DTLparse\result{2025-01-09T14:42:01}
String value: \result.
Data type: \DTLdatumtype{\result}.
Value: \DTLdatumvalue{\result}. 

\DTLparse\result{2025-01-09T15:42:01+01:00}
String value: \result.
Data type: \DTLdatumtype{\result}.
Value: \DTLdatumvalue{\result}. 

\DTLparse\result{14:42:01}
String value: \result.
Data type: \DTLdatumtype{\result}.
Value: \DTLdatumvalue{\result}. 
\end{document}