WordPress.org

Support

Support » Plugins and Hacks » Hacks » Custom Field Date Format Change

Custom Field Date Format Change

  • I have been storing date format in meta key/value. I have been storing in this format (mm/dd/YYYY) now I need to convert that into (YYYYMMDD) SO I can run a date match in query.

    Please advice how can I do that ?

Viewing 1 replies (of 1 total)
  • Moderator bcworkz

    @bcworkz

    This is not my area of expertise, hopefully you get a better answer. In case not, this should be the general form of the query, you will need to modify it to get it working.
    UPDATE table_name SET value = STR_TO_DATE(value,'%m/%d/%Y') WHERE key = 'custom_date';

    Treat this as something to experiment with for lack of better information, not as a real answer.

    Warning! This query form has the power to seriously mess up your table. Add a test row to the table and add something like AND id = row_num LIMIT 1 to the query for limited testing to be sure it is working perfectly before turning it loose on your entire table.

Viewing 1 replies (of 1 total)
  • The topic ‘Custom Field Date Format Change’ is closed to new replies.
Skip to toolbar