You should save the date in a format that is unambiguous so you will get predictable results. The particular format you prefer can’t be parsed by strtotime because it’s not clear which is the month, day, and year. If you convert the date when the meta data is saved, the contents of the field will change to that format and upon second save will become unparseable. It’s better to save it in a clear format and convert it when it’s output to your template.
You can simplify things for your client and be sure that the format will always be parseable by adding a date picker to the meta field that enforces a particular format. This script makes it very easy. Then, in your template:
$your_meta_field_contents="January 23 2012";
$time = strtotime( $your_meta_field_contents );
echo date( 'm d y', $time );
Related Posts:
- Add additional field to custom post_type
- Help Creating a Slideshow Custom Post Type with Custom Meta Boxes?
- Custom Post Type – Taxonomy Dropdown Menu?
- Search that will look in custom field, post title and post content
- How can I add a column/s to wp_posts table?
- How to get custom metabox image field?
- Detect meta value changes when post is updated (post_updated)
- Custom field being erased after autosave
- How to select one major category (or custom taxonomy) for a custom post type?
- Use Custom Post Type as Custom Field
- Saving multiple Metabox contents
- How to save the checked boxes?
- Metabox saving values
- WP insert post PHP function dynamically generated Custom Fields
- add_meta_box: Datepicker like the one for postdate?
- Multiple information using custom post type
- how to set default value for checkbox in wordpress
- Formatting custom meta box date from YYYY/MM/DD to a more readable alternative
- Using WPAlchemy metabox values in another metabox
- Display custom post on home page based on a metabox selection
- Why do I lose the content of meta boxes when I leave the page?
- Dynamically add / duplicate custom meta in custom post types
- WordPress custom meta field for custom post not storing data
- A good strategy to print custom posts (offer) that are checked inside the metabox of a post?
- How to Duplicate (multiple meta box)?
- window.send_to_editor and jQuery .attr() conflicts with multiple custom upload image meta boxes
- List of Posts in a Custom Field
- Save an array from drop-down in custom meta box
- Populate Custom Fields in a Custom Post Type?
- Adding dropdown select meta box to custom post type – seems restAPI is interfering
- Push metadata in array
- Troubles with saving metabox
- How to check if user meta field is empty in conditional else statement
- Replace text in post from cvs
- dynamically add a custom field or metabox to custom post type [duplicate]
- Query & Order posts by custom fields
- Found 2 elements with non-unique id (#_ajax_nonce) and (#_wpnonce)
- Why are taxonomy terms not saving when using custom meta boxes with radio button taxonomy selectors?
- Plugin – Combine Meta Box Input Fields into single saveble record
- get_post_meta not working on publishing
- Using custom field content as expression in IF statement [closed]
- How to Upload CSV Data into Custom Post Type Data with Metabox programmatically
- Repeatable Fields Metabox with Textarea (or wp_editor)
- How to use TinyMCE Editor for one of my custom post meta field?
- Cannot save CPT meta box
- Adding Page Templates to post but it ignored it
- Displaying custom field according to date
- Permalinks: custom structure for taxonomy – tags?
- How can I move (or create another) publish button?
- Custom “radio button meta box” not saving correctly
- Custom Post Meta from custom metaboxes is randomly being deleted
- Add a custom meta box for client to order CPT posts how they want
- create custom meta box with default value
- What do the numbers mean at the end of add_action(‘save_post’)…?
- A meta box (in a custom post type) with two different type of fields
- finding and using post type fields in WordPress
- Get data from PHP to JavaScript to set position of each post on front page
- Get custom term meta problem on single post type
- Display custom meta on page that has been check in custom post type
- CPT Repeatable Fields + Undefined Index
- Adding an extra parameter [string] to my posts’ permalink?
- Add a class to post_class if more than one post shares same meta_value_num
- Add a meta field to the list of results for a custom post type
- Empty meta-box returns publishdate if no value is set?
- Saving metabox keys and storing values as array
- Custom Post Type Meta Box Text Input Field Won’t Save When Blank
- Create an user checklist system for a course plateform using ACF Pro and ACF Extended
- Alike Shortcode using in Custom Shortcode
- Query custom post type that has a serialized relational advanced custom field value
- I’m having trouble with Related Product “tax_query” ‘terms’ value
- Sort custom post column by generated value?
- when looping through custom post data not appearing
- Custom Metabox Info Not Saving
- Problem with multi checkboxes value in metabox?
- Get meta values from parent post and save in child post
- PHP Notice: Unidentified index
- check_admin_referer not working in custom meta box for custom post type
- WordPress loop add heading before first of type
- How to make a shortcode for my WP_Query Loop? [duplicate]
- How to display all custom fields associated with a post type – IN THE ADMIN AREA?
- Avoid another meta box in my custom post type
- Meta box not saving
- Can’t pick up a field created with Advanced Custom Fields
- Meta Box not being added in plugin
- Get month and day from a Date Picker custom field
- Search form to find custom meta box generated data
- Meta-Box to add multiple items one at a time and on publish save all
- Show Custom Post Type taxonomy term that matches custom field
- Order by custom field attribute
- Filter CPT based on meta box value using Flexible Posts widget?
- Select Menu for Custom post Type does not save
- Textarea type on one field custom add_meta_box?
- loop through custom post-type with two meta_keys
- Extending a CPT by Created by another plugin
- Creating entries with image attachements within posts and managing them in a list
- Custom Post Type + Custom Meta Query Not Showing 2012 Posts
- Adding a custom “Add Custom Field” button to Custom Meta boxes
- Send email on creation of custom post type and use get_post_meta()
- Just the First Metabox what saves the data!
- How to consume external API from WordPress post editor and display the response data in the custom field?