I use Drupal7.
I have a profile2's field, named "Birthday".
I set the FIELD TYPE as Date. And, I set Custom input format as "Y-m-d" under "More settings and values" on field edit page. This is because, simply, I want the select list displayed like "2015 07 20(year month day)".
But, on user registration page, it is displayed as "2015 Jul 20". As I wrote, I want to display 01, 02... instead of Jan, Feb... on Select List.
Did I do anything wrong? I apologize if this is an obvious question to you. But, I've been searching the solution for hours and don't find yet. Any tips will be appreciated.
Thank you in advance.

3 Answers 3


I have noticed that same issue that the data entry is not actually showing the data entry points that you want it to when entering items in your form. The data is stored in the data base the way you would like but this is more of a theme item I believe. So since you are using the Data API (I think, if not just turn on the Date API and this should work) you can fix this at the theme level and show the data entry the way you would like. The date API offers a hook that you can use called hook_date_select_process_alter() and you should be able to show the data the way you would like in the front end using this hook.

I would not use string overrides module for this b/c as you state you will change the months everywhere, that is not a good thing.

The code to do this (Would be placed in your theme's template.php file Make sure to clear your site cache after adding this):

 * Implements hook_date_select_process_alter().
function THEMENAME_date_select_process_alter(&$element, &$form_state, $context) {
  // dpm($element); // Uncomment to see before render array.
  // Loop through months and change options to numerical options.
  foreach (date_month_names_untranslated() as $key => $month) {
    // Change #options array, key is built with data API function (The same way that the Date API does this).
    // The sprintf() function is used to make things like 1 into 01 since this is technically a string.
    $element['month']['#options'][$key] = sprintf('%02s', $key);
  // dpm($element); // Uncomment to see after render array.

You can use the $context variable above to limit this to certain forms like the node edit form ($context['form']['#node_edit_form'] is TRUE on the node edit form) or the form id ($context['form']['#form_id']) would equal your form id. I think that this is almost the way that the Date API intends you to change these items since they offer these hooks.

  • Hi burnsjermy! Thank you for your answer. Yes, this worked perfectly :) You saved my day! Jul 20, 2015 at 22:51
  • Awesome! Glad I could help. Please do mark as correct if this solved your issue. Jul 20, 2015 at 22:55

if you go to Administration > Structure > Profile Types > YOURPROFILE > Manage fields

Click on Edit for the field of the DOB

Click on 'More Settings and Values' tab

The displays are on this list. If the issue is that using '-' or '/' instead of the spaces, then I am not sure of the solution .

  • Thank you Deejay for your answer! I tried all of the ways you suggested, '-', '/' and space, on 'More Settings and Values'. But, none of them worked well... I will keep searching another way. Thank you, anyway :) Jul 20, 2015 at 11:48

Go to manage display in account settings In the right had side of your field you can find a settings icon where you can manage the format. You can add even custom format there. As explained in the image below. enter image description here

and in the manage field settings format should be as shown in image below enter image description here

  • Thank you for your answer, BipinK8! Is the " custom format" you say the one you can add on 'admin/config/regional/date-time'? If so, I created my original format, "2015-07-20 20:52:59" and add that. It worked in profile2's view page, but didn't on user register page... Jul 20, 2015 at 11:55
  • Which widget type you are using for date, text field or select list ?
    – Bipin K
    Jul 20, 2015 at 12:09
  • Hope your setting for manage fields is same as image 2 in my answer
    – Bipin K
    Jul 20, 2015 at 12:14
  • Yes, I did same in the setting... But it didn't work. So, does it work under your environment, right? Jul 20, 2015 at 13:36
  • By the way, I use select list. Jul 20, 2015 at 13:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.