[development] submitting date values to database using date_popup type form api

Randy Fay randy at randyfay.com
Fri Feb 4 11:22:47 UTC 2011

If I could, I would try to use a date CCK field, and have all this taken
care of for me. Just wanted to make sure that wasn't an option for you. That
way you maintain no code and write nothing for the database.


On Thu, Feb 3, 2011 at 11: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,

Randy Fay
Drupal Module and Site Development
randy at randyfay.com
+1  970.462.7450
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.drupal.org/pipermail/development/attachments/20110204/65d783c8/attachment.html 

More information about the development mailing list