AnsweredAssumed Answered

date format for search

Question asked by Cliff Stebner on Oct 16, 2015
Hello all,

I am trying to customize a search for the contacts.  I am trying to be able to search for everyone with a birthday either this month, last month, etc.  I've got the field set, but it does not work because it pulls the year as well.  I've been trying to add some code to:

SugarCRM/custom/modules/Contacts/metadata/searchdefs.php

I've changed the code there from:

     'birthdate' =>
      array (
        'type' => 'date',
        'label' => 'LBL_BIRTHDATE',
        'width' => '10%',
        'default' => true,
        'name' => 'birthdate',
      ),

to


      'birthdate' =>
      array (
        'format' => '%m-%d',
        'type' => 'date',
        'label' => 'LBL_BIRTHDATE',
        'width' => '10%',
        'default' => true,
        'name' => 'birthdate',
      ),

and have tried numerous format tries, but with no luck.  Is there a way to get this search to work with only pulling the month and day?  How do I change the format to only look at the month and day, but not the year?

Am I customizing the wrong file?  Am I just missing the correct code to reformat the date to only pull the day and month (no year) in the search?  Please help me get this to work.

Thanks.

Outcomes