0

I'm using babel, datetime & siunitx but I don't see an automatic way to mark and to write time in the french style. It's possible with plain hour with datetime: SI{18}{\hour} -> 18 h. But for hours & minutes, I don't if exists something better than 14~h~27 -> 14 h 27. An idea ?

  • 1
    For scientific use, I'd expect to see either \SI{14.45}{\hour} or SI{867}{\minute} (assuming you really need that accuracy): mixing units doesn't really work. – Joseph Wright Aug 27 '14 at 10:56
2

I am not sure of the french style but you can make your own style with datetime:

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{datetime}

\newtimeformat{frenchtime}{%
\twodigit{\THEHOUR}\ h\ %
\twodigit{\THEMINUTE}\ min}

\settimeformat{frenchtime}

\begin{document}

Et  maintenant il est exactement  \formattime{13}{50}{45}.


Ce document a été généré à \currenttime.  


\end{document}

This MWE should produce a ouput like:

Et maintenant il est exactement 13 h 50 min.

Ce document a été généré à 13 h 50 min.

  • Thanks, it works. We can use in french 13 h 50 min or 13 h 50 with …\twodigit{\THEMINUTE}}. Now, my question is, how to print 9 h 05 & not 09 h 05 ? I imagine without \twodigit… I try – Zouib Aug 27 '14 at 12:48
  • Ok, it works. I edit your answer in this way. Last question, impossible to write only two arguments formattime{}{} instead of formattime{}{}{} ? – Zouib Aug 27 '14 at 12:56
  • I propose for using in french texts this form without \twodigit hour & without \minunits : \newtimeformat{frenchtime}{{\THEHOUR}\ h\ \twodigit{\THEMINUTE}} – Zouib Aug 27 '14 at 13:48
  • 1
    @Zouib, the 3 arguments are mandatory, but you always can make your own command with 2 arguments only: \newcommand\lheure[2]{\formattime{#1}{#2}{00}} – Fran Aug 27 '14 at 21:33

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.