This code places three Elementary Datetime widgets on a window, each of them exemplifying the widget\textquotesingle{}s different usage.

The first of them is {\bfseries{\char`\"{}only Date display\char`\"{}}}\+:  
\begin{DoxyCodeInclude}{0}
\DoxyCodeLine{\ \ \ \textcolor{comment}{//datetime\ showing\ only\ DATE}}
\DoxyCodeLine{\ \ \ datetime\ =\ \mbox{\hyperlink{group__Elm__Datetime_gaea109c95d752a0d951b123a14b959be8}{elm\_datetime\_add}}(bx);}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Evas__Object__Group_ga9379629ad8ad2860aa786d838a4a106a}{evas\_object\_size\_hint\_weight\_set}}(datetime,\ \mbox{\hyperlink{Evas__Common_8h_aa47c85083d3dae0111c21ec49359306a}{EVAS\_HINT\_EXPAND}},\ \mbox{\hyperlink{Evas__Common_8h_aa47c85083d3dae0111c21ec49359306a}{EVAS\_HINT\_EXPAND}});}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Evas__Object__Group_gaaf1d3e26e36b316977336066b6f56632}{evas\_object\_size\_hint\_align\_set}}(datetime,\ \mbox{\hyperlink{Evas__Common_8h_aecbac710f36d52911fc34dcdaf8e729c}{EVAS\_HINT\_FILL}},\ 0.5);}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Elm__Datetime_ga835e428d8876df70aba140f5d5cc7a58}{elm\_datetime\_field\_visible\_set}}(datetime,\ \mbox{\hyperlink{group__Elm__Datetime_ggaa1825497ac8ec6d500439c33945af8b6ac439cdfe1224fd9a51e5eaf0d0977f87}{ELM\_DATETIME\_HOUR}},\ \mbox{\hyperlink{group__Eina__Types__Group_ga1feb115f8e9913e806e090d9bd5a7301}{EINA\_FALSE}});}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Elm__Datetime_ga835e428d8876df70aba140f5d5cc7a58}{elm\_datetime\_field\_visible\_set}}(datetime,\ \mbox{\hyperlink{group__Elm__Datetime_ggaa1825497ac8ec6d500439c33945af8b6a1a06797eb5657a0da15560dbb9603ee9}{ELM\_DATETIME\_MINUTE}},\ \mbox{\hyperlink{group__Eina__Types__Group_ga1feb115f8e9913e806e090d9bd5a7301}{EINA\_FALSE}});}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Elm__Datetime_ga835e428d8876df70aba140f5d5cc7a58}{elm\_datetime\_field\_visible\_set}}(datetime,\ \mbox{\hyperlink{group__Elm__Datetime_ggaa1825497ac8ec6d500439c33945af8b6ac003bb01ee1993ace1e29026a674f37a}{ELM\_DATETIME\_AMPM}},\ \mbox{\hyperlink{group__Eina__Types__Group_ga1feb115f8e9913e806e090d9bd5a7301}{EINA\_FALSE}});}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Elm__Box__Group_ga66a10dd861578521af2ab7b8c2ca65c5}{elm\_box\_pack\_end}}(bx,\ datetime);}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Evas__Object__Group__Basic_ga07208fcafd4739de606bc35fff684bf5}{evas\_object\_show}}(datetime);}

\end{DoxyCodeInclude}
 For {\bfseries{\char`\"{}only Time display\char`\"{}}}, see the second datetime\+:  
\begin{DoxyCodeInclude}{0}
\DoxyCodeLine{\ \ \ \textcolor{comment}{//datetime\ showing\ only\ TIME}}
\DoxyCodeLine{\ \ \ datetime\ =\ \mbox{\hyperlink{group__Elm__Datetime_gaea109c95d752a0d951b123a14b959be8}{elm\_datetime\_add}}(bx);}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Evas__Object__Group_ga9379629ad8ad2860aa786d838a4a106a}{evas\_object\_size\_hint\_weight\_set}}(datetime,\ \mbox{\hyperlink{Evas__Common_8h_aa47c85083d3dae0111c21ec49359306a}{EVAS\_HINT\_EXPAND}},\ \mbox{\hyperlink{Evas__Common_8h_aa47c85083d3dae0111c21ec49359306a}{EVAS\_HINT\_EXPAND}});}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Evas__Object__Group_gaaf1d3e26e36b316977336066b6f56632}{evas\_object\_size\_hint\_align\_set}}(datetime,\ \mbox{\hyperlink{Evas__Common_8h_aecbac710f36d52911fc34dcdaf8e729c}{EVAS\_HINT\_FILL}},\ 0.5);}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Elm__Datetime_ga835e428d8876df70aba140f5d5cc7a58}{elm\_datetime\_field\_visible\_set}}(datetime,\ \mbox{\hyperlink{group__Elm__Datetime_ggaa1825497ac8ec6d500439c33945af8b6a7b6ebba71554e834e8798cdd683358f5}{ELM\_DATETIME\_YEAR}},\ \mbox{\hyperlink{group__Eina__Types__Group_ga1feb115f8e9913e806e090d9bd5a7301}{EINA\_FALSE}});}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Elm__Datetime_ga835e428d8876df70aba140f5d5cc7a58}{elm\_datetime\_field\_visible\_set}}(datetime,\ \mbox{\hyperlink{group__Elm__Datetime_ggaa1825497ac8ec6d500439c33945af8b6a57f9a51d3c792a9ecd58c26ef610ff28}{ELM\_DATETIME\_MONTH}},\ \mbox{\hyperlink{group__Eina__Types__Group_ga1feb115f8e9913e806e090d9bd5a7301}{EINA\_FALSE}});}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Elm__Datetime_ga835e428d8876df70aba140f5d5cc7a58}{elm\_datetime\_field\_visible\_set}}(datetime,\ \mbox{\hyperlink{group__Elm__Datetime_ggaa1825497ac8ec6d500439c33945af8b6ac974324f9e139812cffca7419d7dd71c}{ELM\_DATETIME\_DATE}},\ \mbox{\hyperlink{group__Eina__Types__Group_ga1feb115f8e9913e806e090d9bd5a7301}{EINA\_FALSE}});}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Elm__Box__Group_ga66a10dd861578521af2ab7b8c2ca65c5}{elm\_box\_pack\_end}}(bx,\ datetime);}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Evas__Object__Group__Basic_ga07208fcafd4739de606bc35fff684bf5}{evas\_object\_show}}(datetime);}

\end{DoxyCodeInclude}
 The third one will display datetime shows both {\bfseries{Date and Time}}, corresponding format will be taken from system {\bfseries{locale}}. Note, besides, that the strings are different for different language settings.

{\bfseries{Datetime format}} can be programmatically set by using \mbox{\hyperlink{group__Elm__Datetime_ga75def6ec9fd0ee435c809ddf187c9bac}{elm\+\_\+datetime\+\_\+format\+\_\+set()}}\+:  
\begin{DoxyCodeInclude}{0}
\DoxyCodeLine{\ \ \ \textcolor{comment}{//datetime\ showing\ both\ DATE\ and\ TIME}}
\DoxyCodeLine{\ \ \ datetime\ =\ \mbox{\hyperlink{group__Elm__Datetime_gaea109c95d752a0d951b123a14b959be8}{elm\_datetime\_add}}(bx);}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Evas__Object__Group_ga9379629ad8ad2860aa786d838a4a106a}{evas\_object\_size\_hint\_weight\_set}}(datetime,\ \mbox{\hyperlink{Evas__Common_8h_aa47c85083d3dae0111c21ec49359306a}{EVAS\_HINT\_EXPAND}},\ \mbox{\hyperlink{Evas__Common_8h_aa47c85083d3dae0111c21ec49359306a}{EVAS\_HINT\_EXPAND}});}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Evas__Object__Group_gaaf1d3e26e36b316977336066b6f56632}{evas\_object\_size\_hint\_align\_set}}(datetime,\ \mbox{\hyperlink{Evas__Common_8h_aecbac710f36d52911fc34dcdaf8e729c}{EVAS\_HINT\_FILL}},\ 0.5);}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Elm__Box__Group_ga66a10dd861578521af2ab7b8c2ca65c5}{elm\_box\_pack\_end}}(bx,\ datetime);}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Evas__Object__Group__Basic_ga07208fcafd4739de606bc35fff684bf5}{evas\_object\_show}}(datetime);}

\end{DoxyCodeInclude}
The default format of any locale consists\+:
\begin{DoxyItemize}
\item Year Field
\item Month Field
\item Date Field
\item Hour Field(12hr/24hr format)
\item Minute Field
\item AM/\+PM (if exists).
\end{DoxyItemize}

This is how the example program\textquotesingle{}s window looks like with the datetime widget showing only date, only time and both date \& time\+:

 
\begin{DoxyImageNoCaption}
  \mbox{\includegraphics[width=\textwidth]{screenshots/datetime_example}}
\end{DoxyImageNoCaption}


See the full \mbox{\hyperlink{datetime_example_c}{source code}} for this example. 