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

The first of them is {\bfseries \char`\"{}only Date display\char`\"{}}\-:  
\begin{DoxyCodeInclude}
   \textcolor{comment}{//datetime showing only DATE}
   datetime = elm_datetime_add(bx);
   evas\_object\_size\_hint\_weight\_set(datetime, EVAS\_HINT\_EXPAND, EVAS\_HINT\_EXPAND);
   evas\_object\_size\_hint\_align\_set(datetime, EVAS\_HINT\_FILL, 0.5);
   elm_datetime_field_visible_set(datetime, ELM\_DATETIME\_HOUR, EINA\_FALSE);
   elm_datetime_field_visible_set(datetime, ELM\_DATETIME\_MINUTE, EINA\_FALSE);
   elm_datetime_field_visible_set(datetime, ELM\_DATETIME\_AMPM, EINA\_FALSE);
   elm_box_pack_end(bx, datetime);
   evas\_object\_show(datetime);

\end{DoxyCodeInclude}


For {\bfseries \char`\"{}only Time display\char`\"{}}, see the second datetime\-:  
\begin{DoxyCodeInclude}
   \textcolor{comment}{//datetime showing only TIME}
   datetime = elm_datetime_add(bx);
   evas\_object\_size\_hint\_weight\_set(datetime, EVAS\_HINT\_EXPAND, EVAS\_HINT\_EXPAND);
   evas\_object\_size\_hint\_align\_set(datetime, EVAS\_HINT\_FILL, 0.5);
   elm_datetime_field_visible_set(datetime, ELM\_DATETIME\_YEAR, EINA\_FALSE);
   elm_datetime_field_visible_set(datetime, ELM\_DATETIME\_MONTH, EINA\_FALSE);
   elm_datetime_field_visible_set(datetime, ELM\_DATETIME\_DATE, EINA\_FALSE);
   elm_box_pack_end(bx, datetime);
   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 \hyperlink{group__Datetime_ga75def6ec9fd0ee435c809ddf187c9bac}{elm\-\_\-datetime\-\_\-format\-\_\-set()}\-:  
\begin{DoxyCodeInclude}
   \textcolor{comment}{//datetime showing both DATE and TIME}
   datetime = elm_datetime_add(bx);
   evas\_object\_size\_hint\_weight\_set(datetime, EVAS\_HINT\_EXPAND, EVAS\_HINT\_EXPAND);
   evas\_object\_size\_hint\_align\_set(datetime, EVAS\_HINT\_FILL, 0.5);
   elm_box_pack_end(bx, datetime);
   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 A\-M/\-P\-M (if exists).
\end{DoxyItemize}

This is how the example program's window looks like with the datetime widget showing only date, only time and both date \& time\-:

 
\begin{DoxyImage}
\includegraphics{screenshots/datetime_example}
\caption{width=}
\end{DoxyImage}


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