Custom Field Date Format Change (2 posts)

  1. donboy7
    Posted 2 years ago #

    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 ?

  2. bcworkz
    Posted 2 years ago #

    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.

Topic Closed

This topic has been closed to new replies.

About this Topic