Datetime widget example

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

The first of them is "only Date display":

For "only Time display", see the second datetime:

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

Datetime format can be programmatically set by using elm_datetime_format_set():

//datetime showing both DATE and TIME
datetime = elm_datetime_add(bx);
elm_box_pack_end(bx, datetime);
evas_object_show(datetime);

The default format of any locale consists:

  • Year Field
  • Month Field
  • Date Field
  • Hour Field(12hr/24hr format)
  • Minute Field
  • AM/PM (if exists).

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

See the full source code for this example.

ELM_DATETIME_MINUTE
@ ELM_DATETIME_MINUTE
Indicates Minute field.
Definition: elm_datetime.h:214
elm_datetime_field_visible_set
void elm_datetime_field_visible_set(Evas_Object *obj, Elm_Datetime_Field_Type fieldtype, Eina_Bool visible)
Set a field to be visible or not.
Definition: elm_datetime.c:158
elm_datetime_add
Evas_Object * elm_datetime_add(Evas_Object *parent)
Adds a new datetime Widget.
Definition: elm_datetime.c:40
EINA_FALSE
#define EINA_FALSE
boolean value FALSE (numerical value 0)
Definition: eina_types.h:533
EVAS_HINT_EXPAND
#define EVAS_HINT_EXPAND
Use with evas_object_size_hint_weight_set(), evas_object_size_hint_weight_get(), evas_object_size_hin...
Definition: Evas_Common.h:292
ELM_DATETIME_AMPM
@ ELM_DATETIME_AMPM
Indicates AM/PM field .
Definition: elm_datetime.h:215
ELM_DATETIME_MONTH
@ ELM_DATETIME_MONTH
Indicates Month field.
Definition: elm_datetime.h:211
evas_object_size_hint_weight_set
void evas_object_size_hint_weight_set(Evas_Object *obj, double x, double y)
Sets the hints for an object's weight.
Definition: evas_object_main.c:2638
evas_object_size_hint_align_set
void evas_object_size_hint_align_set(Evas_Object *obj, double x, double y)
Sets the hints for an object's alignment.
Definition: evas_object_main.c:2650
evas_object_show
void evas_object_show(Evas_Object *eo_obj)
Makes the given Evas object visible.
Definition: evas_object_main.c:1814
EVAS_HINT_FILL
#define EVAS_HINT_FILL
Use with evas_object_size_hint_align_set(), evas_object_size_hint_align_get(), evas_object_size_hint_...
Definition: Evas_Common.h:293
ELM_DATETIME_YEAR
@ ELM_DATETIME_YEAR
Indicates Year field.
Definition: elm_datetime.h:210
ELM_DATETIME_HOUR
@ ELM_DATETIME_HOUR
Indicates Hour field.
Definition: elm_datetime.h:213
ELM_DATETIME_DATE
@ ELM_DATETIME_DATE
Indicates Date field.
Definition: elm_datetime.h:212