Title: Date from date picker cannot mapped correctly
Last modified: May 5, 2024

---

# Date from date picker cannot mapped correctly

 *  Resolved [locker17](https://wordpress.org/support/users/locker17/)
 * (@locker17)
 * [2 years, 1 month ago](https://wordpress.org/support/topic/date-from-date-picker-cannot-mapped-correctly/)
 * Unfortunately the date saving problem which you marked as solved is not solved
   yet.
   I was asking to show the date from the date picker as d/m/Y or d-m-Y but
   save it as Y-m-d 00:00:00 like mysql datetime or date format.You wrote this:
 *     ```wp-block-code
       add_filter( 'user_registration_validate_date', 'ur_format_date_field', 10, 4 );
   
       function ur_format_date_field($single_form_field, $data, $filter_hook, $form_id) {
   
          // Change format of the date
   
       }
       ```
   
 * I need more help with that. How to change it, do I have to return any value???
   Does $data holds the date as d/m/Y?

Viewing 2 replies - 1 through 2 (of 2 total)

 *  [Sandip Pokhrel](https://wordpress.org/support/users/sandippokharel/)
 * (@sandippokharel)
 * [2 years, 1 month ago](https://wordpress.org/support/topic/date-from-date-picker-cannot-mapped-correctly/#post-17740428)
 * Hi [@locker17](https://wordpress.org/support/users/locker17/)
 * Here is the required code.
 *     ```wp-block-code
       add_filter( 'user_registration_validate_date', 'ur_format_date_field', 11, 4 );
   
       function ur_format_date_field($single_form_field, $data, $filter_hook, $form_id) {
   
          if ( isset( $data->value ) ) {
           $timestamp = DateTime::createFromFormat('d/m/Y', $data->value);
   
           $formattedDate = $timestamp->format('Y/m/d 00:00:00');
           $data->value   = $formattedDate;
          }
   
          return $data;
       }
       ```
   
 * Note: This works only during the registration process.
 * Regards!
 *  Thread Starter [locker17](https://wordpress.org/support/users/locker17/)
 * (@locker17)
 * [2 years, 1 month ago](https://wordpress.org/support/topic/date-from-date-picker-cannot-mapped-correctly/#post-17746742)
 * tested, works. Thanks!

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Date from date picker cannot mapped correctly’ is closed to new replies.

 * ![](https://ps.w.org/user-registration/assets/icon-256x256.gif?rev=3284028)
 * [User Registration & Membership - Free & Paid Memberships, Subscriptions, Content Restriction, User Profile, Custom User Registration & Login Builder](https://wordpress.org/plugins/user-registration/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/user-registration/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/user-registration/)
 * [Active Topics](https://wordpress.org/support/plugin/user-registration/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/user-registration/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/user-registration/reviews/)

 * 2 replies
 * 2 participants
 * Last reply from: [locker17](https://wordpress.org/support/users/locker17/)
 * Last activity: [2 years, 1 month ago](https://wordpress.org/support/topic/date-from-date-picker-cannot-mapped-correctly/#post-17746742)
 * Status: resolved