[development] Hello from another developer/Want to add some features

Khalid B kb at 2bits.com
Sun Jan 29 02:10:56 UTC 2006


His question was about the lack of a field with type "time", and "date
time" in FAPI.

The forms allow a year, month, date, but not an hour, minute, second field.

On 1/28/06, Robert Douglass <rob at robshouse.net> wrote:
> Sammy Spets wrote:
>
> > AFAIK drupal doesn't have a time field with two dropdowns and a datetime
> > where the date and time fields are combined into one to fully utilize
> > the timestamp type of a DB.
>
>    $form['effective_date'] = array(
>      '#type' => 'date',
>      '#title' => t('Effective date'),
>      '#default_value' => $node->effective_date ? array('day' =>
> $node->effective_date[2],
>                              'month' => $node->effective_date[1],
>                              'year' => $node->effective_date[0])
>      : array('day' => format_date(time(), 'custom', 'j'),
>              'month' => format_date(time(), 'custom', 'n'),
>              'year' => format_date(time(), 'custom', 'Y')),
>      '#required' => FALSE);
>


More information about the development mailing list