4

I have now created this MWE:

\documentclass[12pt,margin=3mm]{standalone}
\usepackage{newtxtext}
\usepackage[dvipsnames]{xcolor}
\usepackage{tikz}
\usepackage{datetime2}
\usepackage{fontawesome5}

\begin{document} \begin{tikzpicture} \draw (0,0) node[minimum size=4cm,draw=red!60,circle,line width=2mm] {\large\textbf{\DTMnow}}; \node at (0,1) (A) {\textcolor{Green}{\Large \faCheckCircle}}; \node at (0,-1) (B) {\large \textsc{Approved}}; \end{tikzpicture}

\end{document}

with this output:

enter image description here

Using datetime2 package, how I can this italian date structure?

enter image description here

Sebastiano
  • 54,118

1 Answers1

5

Probably this is not the most elegant solution, but you can use \DTMtoday and \DTMcurrenttime instead of \DTMnow and add the options text width=3cm and align=center to your node. In order to change the date format, you can use \DTMsetdatestyle{ddmmyyyy}. If you also want to get rid of the seconds, add the package option showseconds=false to the datetime2 package.

Full example:

\documentclass[12pt,margin=3mm]{standalone}
\usepackage{newtxtext}
\usepackage[dvipsnames]{xcolor}
\usepackage{tikz}
\usepackage{datetime2}
\usepackage{fontawesome5}

\DTMsetdatestyle{ddmmyyyy}

\begin{document} \begin{tikzpicture} \draw (0,0) node[minimum size=4cm, draw=red!60, circle, line width=2mm, text width=3cm, align=center] {\large \bfseries \mbox{\DTMtoday} \DTMcurrenttime}; \node at (0,1) (A) {\textcolor{Green}{\Large \faCheckCircle}}; \node at (0,-1) (B) {\large \textsc{Approved}}; \end{tikzpicture} \end{document}


Here is another version using the italian localization module.

\documentclass[12pt,margin=3mm,italian]{standalone}
\usepackage{newtxtext}
\usepackage[dvipsnames]{xcolor}
\usepackage{tikz}
\usepackage[useregional=numeric,showseconds=true,showzone=false]{datetime2}
\usepackage{fontawesome5}

\begin{document} \begin{tikzpicture} \draw (0,0) node[minimum size=4cm, draw=red!60, circle, line width=2mm, text width=3cm, align=center] {\large \bfseries \mbox{\DTMtoday} \DTMcurrenttime}; \node at (0,1) (A) {\textcolor{Green}{\Large \faCheckCircle}}; \node at (0,-1) (B) {\large \textsc{Approved}}; \end{tikzpicture} \end{document}

leandriis
  • 62,593
  • Thank you very very much. Why is it not elegant solution? Why I have 21:27 like a time instead of 23:27? – Sebastiano Oct 17 '20 at 21:28
  • I have put the \usepackage[showseconds=true]{datetime2} and not false, and now I see the seconds :-)...but the hour in Italy is 23:56. But it's not that I have the wrong time zone? :-) :-) How fix it? – Sebastiano Oct 17 '20 at 21:57
  • 3
    @Sebastiano - Is your system maybe configured to show GMT (Greenwich mean time) instead of local time? Or is it just a coincidence that the difference between the two times is currently 2 hours? – Mico Oct 18 '20 at 05:54
  • @Sebastiano: Regarding the seconds not showing up: Which compiler did you use to compile the example document? I used PDFLaTeX and get the seconds by default. With XeLaTeX on the other hand, seconds are omitted by default and can be shown upon using the showseconds=true package option. – leandriis Oct 18 '20 at 11:02
  • @leandriis Hi. Last night I went to sleep at 1:30 am reading the manual and I have make many compilations. I had tried also with singolar option or double options for the datatime2 without a solution. I have understood only a few minutes ago that the reason of the hour in Italy is not to have used my updated MikTeX but Papeeria, an online editor more fast of MikTeX on this OS W7 32-bit. Papeeria use TeXlive2019. I often use pdfLaTeX and very very few the others engines. However your solution it is correct: https://i.stack.imgur.com/5jsol.png :-( excuse very much. – Sebastiano Oct 18 '20 at 11:33
  • @Mico Hi to you too.Unfortunately I had read the manual so many times that I couldn't set the Italian time zone :-( GMT+1. Thank you very much for your support. – Sebastiano Oct 18 '20 at 11:35