How to use datepicker pop up in a form field in a custom module?

· konordo
Ever needed to use datepicker pop up in a custom module? That would be the most usable way to allow users to choose a date. Here is the code to be used in the form function: t('Date From'), '#type' => 'date_popup', '#date_format' => $format, '#description' => t('Please select a date'), ); ?>