[support] submitting date values to database using date_popup type form api
Ursula Pieper
dramamezzo at gmail.com
Fri Feb 4 17:26:14 UTC 2011
This is really a mysql question. You should review the date section in
the mysql manual:
http://dev.mysql.com/doc/refman/5.1/en/datetime.html
In short: If it's just a date, then then "date" type would be the most
appropriate.
There are several examples on how to populate the field in that manual
page. yyyy-mm-dd would work, as would yyyymmdd and a couple of other
options.
mysql retrieves the date field type as yyyy-mm-dd.
Ursula
On Thu, Feb 3, 2011 at 10:03 PM, mahesh gajabar <mahesh143an at gmail.com> wrote:
> Hi,
> I have a form element called date in my module file like this ..
> $format='Y-m-d';
> $form['date'] = array(
> '#type' => 'date_popup',
> '#title' => t(' Date'),
> '#date_format' => $format,
> );
>
> date pop up Is coming fine and I can select date easily. Issue ahead me is
> to submit this date to database and show it in my edit form with default
> value which I submitted in databse. How I can submit this date to database
> (which is the better data type in table for this field? Is it int or date
> or datetime in mysql?) and retvieve it in Year-Month-date format to show on
> screen. I am new baby to drupal .Please help me guys.
>
> Mahi,
>
>
> --
> [ Drupal support list | http://lists.drupal.org/ ]
>
More information about the support
mailing list