As was told at MySQL Using a string column with date text as a date field, you can do
SELECT STR_TO_DATE(yourdatefield, '%m/%d/%Y') FROM yourtable
You can also handle these date strings in WHERE
clauses. For example
SELECT whatever FROM yourtable WHERE STR_TO_DATE(yourdatefield, '%m/%d/%Y') > CURDATE() - INTERVAL 7 DAY
You can handle all kinds of date/time layouts this way. Please refer to the format specifiers for the DATE_FORMAT()
function to see what you can put into the second parameter of STR_TO_DATE()
.
Related Posts:
- MySQL date formats – difficulty Inserting a date
- How to use greater than operator with date?
- SQL query to update post_date (one post = one single date & time)
- How to add 2 hours to the wordpress time formed with current_time(“mysql”, false)?
- Copyright: Get first and last date of post type
- User set date and time from frontend doesn’t get stored into database
- Cannot add or update a child row: a foreign key constraint fails
- Java string to date conversion
- sql query with multiple where statements
- Cannot delete or update a parent row: a foreign key constraint fails
- ERROR 2003 (HY000): Can’t connect to MySQL server on localhost (10061)
- Rename a column in MySQL
- Not unique table/alias
- Install mysql-python (Windows)
- #1055 – Expression of SELECT list is not in GROUP BY clause and contains nonaggregated column this is incompatible with sql_mode=only_full_group_by
- Can’t connect to local MySQL server through socket ‘/var/lib/mysql/mysql.sock’ (2)
- Disable ONLY_FULL_GROUP_BY
- MySQL WHERE IN ()
- Is there an SQLite equivalent to MySQL’s DESCRIBE [table]?
- SELECT list is not in GROUP BY clause and contains nonaggregated column …. incompatible with sql_mode=only_full_group_by
- Host ‘xxx.xx.xxx.xxx’ is not allowed to connect to this MySQL server
- difference between primary key and unique key
- Converting string to Date and DateTime
- How to export a mysql database using Command Prompt?
- Should I use the datetime or timestamp data type in MySQL?
- Access denied; you need (at least one of) the SUPER privilege(s) for this operation
- How do I change the data type for a column in MySQL?
- MySQL > Table doesn’t exist. But it does (or it should)
- Unknown Column In Where Clause
- Cannot connect to Database server (mysql workbench)
- mysqld: Can’t change dir to data. Server doesn’t start
- How to solve “Error: MySQL shutdown unexpectedly”?
- Can you do a For Each Row loop using MySQL?
- SQLSTATE[HY000] [2002] php_network_getaddresses: getaddrinfo failed: Name or service not known
- Drop all databases in MySQL
- How to properly create composite primary keys – MYSQL
- Failed to Connect to MySQL at localhost:3306 with user root
- MySQL – count total number of rows in php
- How to get the count of each distinct value in a column?
- Data is not constantly loading from custom wordpress table
- How to run WordPress across 2 VMs for high availability
- Mysqldump add drop table?
- How to disable `SQL_CALC_FOUND_ROWS` [duplicate]
- “#1067 – Invalid default value for ‘post_date'” when trying to reset AI after backup
- #1115 – Unknown character set: ‘utf8mb4’
- WordPress Deadlock Error
- How to do a MySQL dump from production site without using a search and replace script for local development?
- How to bulk edit canonical url’s in SQL?
- Concurrent / simultaneous MySQL connections
- How to check for empty and not a failure
- How many ‘wp_insert_post’ calls can be performed in one shot, in a very long ‘for’ loop?
- Keeping database within limits, please help!
- Best settings for MySQL to speed up site? [closed]
- HTML Entities in Post Title
- Distinction on meta value on pre_get_posts
- Can’t find my wordpress DB in phpmyadmin
- Deprecated: mysql_connect():
- MySQL Rank & $wpdb
- $wpdb select all meta for each post
- Calculate average crossing post categories
- Replacing link URL ending strings via MySQL
- Site not responding error – taking long to load [closed]
- Many slow queries post_type = ‘attachment’;
- SQL command to convert all tags in lowercase?
- Problem with admin login after deployment
- Find out how many times the user has logged in
- Is it possible to create a WordPress table using array and loop?
- Can’t run database query
- How to stop $wpdb from prepending database name
- Match tag names with form titles
- Error missing MySQL extension
- Replace a character in all post titles and slugs
- Getting Error Trying to Create Table
- Best approach for a custom database filling in WP custom post types
- Understanding custom php that reads from WP MYSQL
- Why doesn’t custom mysql query return results? Is syntax correct?
- Insert two row in wordpress database
- Way to extract wordpress data from folder backup
- SQL statement using placeholder is not returning results
- How to Bulk find and replace MySQL for post image url
- Wpdb query with dynamic table name
- Regular XML-RPC timeouts
- update multiple rows in mysqli table base on two values
- WordPress asks to install, but is already installed?
- How can I verify WordPress nonce from the following code?
- How to write in MySQL more characters in user_nicename
- An SQL query to find orphaned image attachments and their meta
- $wpdb->get_var not returning count
- Custom user query – orderby meta_key (that may not exist)
- How to get Attachments(image) with specific width\height ratio
- What is the cron doing?
- Simple SQL Query in wordpress
- Apache Redirect based on WordPress permissions
- SQL error on restoring database
- MySQL database gives blank page (white screen of death)
- Datatabase error: Commands out of sync
- why is $wpdb->update() causing a DB error from within wp_set_password()
- Global MySQL replacing of text patterns/matches
- InnoDB: Error: log file ./ib_logfile0 is of different size
- Postgres equivalent to MySQL’s \G?