If you change the saved date format to YYYY-MM-DD HH:MM
(always with leading zeroes). You can use the usort() array sorting function from php.
usort( $array, function( $a, $b ) {
return strcomp( $a['show_date_and_time'], $b['show_date_and_time'] );
} );
Without changing the date format you need a more complex compare callback:
usort( $array, function( $a, $b ) {
$date_a = date_create_from_format( 'j-m-Y H:i', $a['show_date_and_time'] );
$date_b = date_create_from_format( 'j-m-Y H:i', $b['show_date_and_time'] );
if ( $date_a > $date_b ) {
return 1;
} else if ( $date_a == $date_b ) {
return 0;
}
return -1;
} );
Related Posts:
- How to get WordPress Time Zone setting?
- Converting timestamps to local time with date_l18n()
- PHP function showing wrong time in WordPress
- Display sorting options dropdown when using WooCommerce product category shortcode
- Drop down+sort blog posts date added/most popular
- How to get year, month and hour in WordPress?
- What is the most efficient way to search users by their display name?
- Archive listing of posts by publish year (multiple years)
- Why does this echo values in the wrong order?
- WordPress returns a wrong date
- How to check for WordPress timezone type?
- Unable to set right time in admin and frontend template
- Sortable admin column for one meta key with three possible meta values
- Convert a date to ISO8601 date format
- wrong php date()?
- list posts and wrap them alphabetically A-Z
- Order posts randomly, not by date
- display month in french in wordpress/php?
- Displaying the Month and Year that a page was Created?
- Nesting if statements to echo only one string based on what tag was filtered?
- Get date numerical and separate?
- Sort posts by custom fields value using dropdown menu
- How to Sort posts by Vote Count?
- Sort query_posts for Parent Pages to menue order or the count?
- How to sort posts based on the value (number) of a post’s metadata?
- Sort custom meta column by other meta value
- Sort the result of the main Query in shop page by a custom taxonomy
- Print last modified date only on posts
- Sort by page information by Ascending Numbers
- Find hours between post_date and post_date_gmt
- 3 different times on my WordPress website
- How to keep track of when a vote is cast?
- How to get User Time Zone in WordPress?
- Check If Post Was Published More Than 6 Months Ago Using get_the_date
- How do I check or test a WordPress Auto Year Change Script?
- change the default order of posts only for specific categories
- Order BY Most Liked And Published Between Previous Week Monday And Next Week Monday
- Shortcode function doesnt work without caption
- How to tag the main tag? [closed]
- Removing custom sort order from admin page listing
- Comparing Dates from custom field
- Get date function not working
- PHP time function ($today) for GMT +1
- Hide publish date when update date
- If Post Published Date or Modified Date is 1 Year or Older, Display Notice on Post Page
- How to detect and handle the time difference between server and user in WordPress?
- WordPress sorting posts by date and title using a dropdown
- No more get_option(‘date_time’) in WordPress 5.5?
- WordPress wrong dates bug
- How to pull date/time in french format for wordpress post?
- Can’t add to time? [closed]
- How to sort (orderby) a query done by a template function before the ‘foreach’ loop?
- Ordering / grouping posts by datepicker ACF
- Adding a number to a date
- Display Year and Month from custom field + Age Calculator
- Page 2+ of taxonomy archives does not recognise sort-order from dropdown
- Query category-specific, paginated posts and allow viewer to change sort order
- Sort posts by title, sort array by largest number [duplicate]
- WordPress – show all posts + ones with specific tag
- Can i show items based on the day with php?
- ISOTOPE – Missing/Invalid Arguement Get Terms
- Posts sortable column not sorting properly for custom field numbers
- category & sub category order issues in wordpress
- Sort author list alphabetically
- Display Current Time using shortcode
- How do I convert a custom field to a php date format? [closed]
- Change date/time format in custom plugin
- Convert custom field date format to “WordPress default”
- What is wrong with my sorting logic?
- function_exists call in function.php
- How can i display 3 post types in same page?
- Make first letter of my taxonomy uppercase
- Insert all post IDs in new database table
- Renaming post IDs – Okay to do?
- Add the Name of Products Ordered to Admin New Order Email WooCommerce
- Get Post Meta from ID in functions.php
- Why File_exists returns true with or without ABSPATH?
- WordPress automatically adds links to uploaded images
- get_template_directory_uri() providing wrong path for img
- HTML showing after PHP code in tag
- Adding Author Box Meta Links with Co-Authors
- Lost in trying to create user database system
- Remove   from the_excerpt
- Why is my max_upload_filesize being limited to 2M? [duplicate]
- Can’t pass the variable from a select to PHP query
- “if parent category is” conditional?
- Deactivate a plugin on wp version
- the_post_thumbnail issues
- linked php file not executing php
- Add other class content with reference class value
- Slug duplicates once clicking on link
- Language does not switch while cache is enabled
- How can I update the price when someone enters postcode or zip code in woocommerce checkout page?
- Limit content size by character or word in database
- Set user status to absent on WordPress
- Customizer: How to Sanitize a Decimal Number Range
- Adding button to wordpress menu
- List users in a dropdown for login
- WordPress pagination broken on blog page, working for search results page
- wp_get_archive for category returning different URLs on different but similar sites