| 1 |
% This file is public domain. |
| 2 |
|
| 3 |
% arara: pdflatex |
| 4 |
\documentclass[italian]{article} |
| 5 |
|
| 6 |
\usepackage[calc,useregional]{datetime2} |
| 7 |
|
| 8 |
\begin{document} |
| 9 |
|
| 10 |
\DTMsavejulianday{mydate}{2457023} |
| 11 |
\DTMsavedate{mydate2}{2014-06-20} |
| 12 |
|
| 13 |
Date: \DTMusedate{mydate}. |
| 14 |
|
| 15 |
\newcount\myct |
| 16 |
\DTMsaveddatetojulianday{mydate}{\myct} |
| 17 |
|
| 18 |
Julian day number: \number\myct. |
| 19 |
|
| 20 |
\DTMsaveddateoffsettojulianday{mydate}{2}{\myct} |
| 21 |
|
| 22 |
Julian day number (offset+2): \number\myct. |
| 23 |
|
| 24 |
Is \texttt{mydate2} (\DTMusedate{mydate2}) before |
| 25 |
\texttt{mydate} (\DTMusedate{mydate})? |
| 26 |
\DTMifdate |
| 27 |
{mydate2} |
| 28 |
{at most= |
| 29 |
\DTMfetchyear{mydate}-\DTMfetchmonth{mydate}-\DTMfetchday{mydate}} |
| 30 |
{yes}{no}. |
| 31 |
|
| 32 |
Is \texttt{mydate2} (\DTMusedate{mydate2}) after |
| 33 |
\texttt{mydate} (\DTMusedate{mydate})? |
| 34 |
\DTMifdate |
| 35 |
{mydate2} |
| 36 |
{at least= |
| 37 |
\DTMfetchyear{mydate}-\DTMfetchmonth{mydate}-\DTMfetchday{mydate}} |
| 38 |
{yes}{no}. |
| 39 |
|
| 40 |
\DTMsaveddatediff{mydate}{mydate2}{\myct} |
| 41 |
|
| 42 |
\DTMusedate{mydate} is |
| 43 |
\ifnum\myct=0 |
| 44 |
the same day as |
| 45 |
\else |
| 46 |
\ifnum\myct<0 |
| 47 |
\number-\myct\space day\ifnum\myct<-1s\fi\space before |
| 48 |
\else |
| 49 |
\number\myct\space day\ifnum\myct>1s\fi\space after |
| 50 |
\fi |
| 51 |
\fi |
| 52 |
\DTMusedate{mydate2}. |
| 53 |
|
| 54 |
Original date: 2014-06-3 20:45:00 +06:00 |
| 55 |
|
| 56 |
\DTMsaveaszulutime{mydate}{2014}{6}{3}{20}{45}{0}{6}{0} |
| 57 |
UTC+00:00 date: \DTMuse{mydate}. |
| 58 |
|
| 59 |
\DTMsavetimestamp{mydate}{2014-05-01T03:55:00 -06:00} |
| 60 |
Original date: \DTMuse{mydate}. |
| 61 |
|
| 62 |
\DTMtozulu{mydate}{mydate2} |
| 63 |
UTC+00:00: \DTMuse{mydate2}. |
| 64 |
|
| 65 |
Offset: \DTMdate{2015-03-30+4}. |
| 66 |
|
| 67 |
Last: \DTMdate{2015-02-last}. |
| 68 |
|
| 69 |
Last with offset: \DTMdate{2015-02-last+-2}. |
| 70 |
|
| 71 |
Saved date with offset |
| 72 |
\DTMsavedate{offset}{2015-02-last+-2} |
| 73 |
|
| 74 |
Use date: \DTMusedate{offset}. |
| 75 |
|
| 76 |
\end{document} |