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

  • You can use \DTMsetdatestyle{ddmmyyyy} to change the date from "year-month-day" to "day-month-year". How exactly should the "time" part look like? – leandriis 2 days ago
  • 1
    Is this the output you want to achieve? i.stack.imgur.com/79Sxr.png – leandriis 2 days ago
  • @leandriis Very kind hours, minutes and seconds in Italian time. Thank you for your interest.....For your 2nd comment the image it is perfect! – Sebastiano 2 days ago
  • 1
    So, basically like the following? i.stack.imgur.com/nFsb3.png – leandriis 2 days ago
  • @leandriis Perfect! Here in Italy are the 23:23 (pm). – Sebastiano 2 days ago
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}
| improve this answer | |
  • Thank you very very much. Why is it not elegant solution? Why I have 21:27 like a time instead of 23:27? – Sebastiano 2 days ago
  • 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 2 days ago
  • 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 yesterday
  • @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 yesterday
  • @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: i.stack.imgur.com/5jsol.png :-( excuse very much. – Sebastiano yesterday

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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