Title: Split date/time to custom fields
Last modified: May 17, 2021

---

# Split date/time to custom fields

 *  Resolved [dvorinm3](https://wordpress.org/support/users/dvorinm3/)
 * (@dvorinm3)
 * [5 years ago](https://wordpress.org/support/topic/split-date-time-to-custom-fields/)
 * Hello,
    I am pretty newbie in WordPress and PHP, please could you give me an 
   advice how to solve this issue?
 * I use date and time picker for event start/end. Then I use Elementor dynamic 
   tags to display it. But I need to have two headings with different CSS format
   for day and for month.
 * My idea is to use save_post hook, separate these two figures picked in date/time
   picker and save them to another custom fields “day” and “month” as format e.g.“
   1” and “JAN”.
 * I tried code below (for month), but it is not working
 *     ```
       add_action('save_post', 'separateEventStartDate', 10, 2);
       function separateEventStartDate($post_id)
       {
       	// if date/time is not picked, return
       	if (empty(get_post_meta($post_id, 'event_start', true))) {
       		return;
       	} else
   
       	// load picked date and time to variable
       	$eventStart = $_POST['pods_meta_event_start'];
   
       	// change format to abbreviated month e.g. "JAN"
       	$eventStartMonth = date("M", strtotime($eventStart));
   
       	// save month to custom field
       	update_post_meta($post_id, 'month', $eventStartMonth);
       }
       ```
   
 * What am I asking:
 * 1) Is it possible to make it this way?
    2) What is the default format how PODS
   save date and time from picker. Is it object, array, string? 3) Do I use correct
   functions to get/save meta fields? 4) Is there a way to display (console, admin
   page) variable value to check it?
 * Thank you for any ideas!

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

 *  Plugin Author [Jory Hogeveen](https://wordpress.org/support/users/keraweb/)
 * (@keraweb)
 * [5 years ago](https://wordpress.org/support/topic/split-date-time-to-custom-fields/#post-14447123)
 * Hi [@dvorinm3](https://wordpress.org/support/users/dvorinm3/)
 * Storage of dates is always in MySQL format (YYYY-MM-DD HH:MM).
    Formatting dates
   should be done while displaying.
 * I assume you can create two modules in Elementor using the same date field and
   then set a custom format right?
 * If you really need extra custom fields you could indeed do it like you suggested
   but it seems a bit cumbersome.
    You can use WordPress core functions for getting
   and updating metadata.
 * Cheers, Jory
 *  Thread Starter [dvorinm3](https://wordpress.org/support/users/dvorinm3/)
 * (@dvorinm3)
 * [5 years ago](https://wordpress.org/support/topic/split-date-time-to-custom-fields/#post-14472367)
 * Great thanks! I overlooked or maybe after Elementor update there really is the
   field where I can change Date and Time format.

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

The topic ‘Split date/time to custom fields’ is closed to new replies.

 * ![](https://ps.w.org/pods/assets/icon.svg?rev=3286397)
 * [Pods - Custom Content Types and Fields](https://wordpress.org/plugins/pods/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/pods/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/pods/)
 * [Active Topics](https://wordpress.org/support/plugin/pods/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/pods/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/pods/reviews/)

## Tags

 * [date-time picker](https://wordpress.org/support/topic-tag/date-time-picker/)

 * 2 replies
 * 2 participants
 * Last reply from: [dvorinm3](https://wordpress.org/support/users/dvorinm3/)
 * Last activity: [5 years ago](https://wordpress.org/support/topic/split-date-time-to-custom-fields/#post-14472367)
 * Status: resolved