\section{datetime\+\_\+example.\+c}

\begin{DoxyCodeInclude}
\textcolor{comment}{//Compile with:}
\textcolor{comment}{//gcc -g datetime\_example.c -o datetime\_example `pkg-config --cflags --libs elementary`}

\textcolor{preprocessor}{#include <Elementary.h>}

EAPI\_MAIN \textcolor{keywordtype}{int}
elm\_main(\textcolor{keywordtype}{int} argc, \textcolor{keywordtype}{char} *argv[])
\{
   Evas\_Object *win, *bx, *datetime;

   elm_policy_set(ELM\_POLICY\_QUIT, ELM\_POLICY\_QUIT\_LAST\_WINDOW\_CLOSED);

   win = elm_win_util_standard_add(\textcolor{stringliteral}{"Datetime"}, \textcolor{stringliteral}{"Datetime"});
   elm_win_autodel_set(win, EINA\_TRUE);

   bx = elm_box_add(win);
   evas\_object\_size\_hint\_weight\_set(bx, EVAS\_HINT\_EXPAND, EVAS\_HINT\_EXPAND);
   elm_win_resize_object_add(win, bx);
   elm_box_horizontal_set(bx, EINA\_FALSE);
   evas\_object\_show(bx);

   \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);

   \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);

   \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);

   evas\_object\_show(win);

   elm_run();

   \textcolor{keywordflow}{return} 0;
\}
ELM_MAIN()
\end{DoxyCodeInclude}
 