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():
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.