Use this code for the difference between two dates:
$date1 = '2012-12-12'; $date2 = '2012-12-20'; $start_date = strtotime($date1); $end_date = strtotime($date2); echo ($end_date - $start_date)/60/60/24;
Simple like that:
$start_date = strtotime('2012-12-12'); $end_date = strtotime('2012-12-20'); echo ($end_date - $start_date)/60/60/24;
Related Posts:
- Sending the reset password link programatically
- WordPress Themes and PHP unit
- Pass media upload value to input field
- Sorting list of sites from multisite network using wp_get_sites
- wpdb::prepare was called incorrectly
- Adding a search form inside a div
- How to check from which page the user is coming to the current page?
- the_title() & the_content() are retrieving Post details inside a Page, after calling a shortcode
- Getting a fatal error while updating
- How to display blog images using wordpress in existing project
- Woocommerce filter cart and category specific quantity [closed]
- How should I best target dynamically served content?
- How to get woocommerce cart content without an action?
- php syntax – how to concatenate properly – echo bloginfo(‘stylesheet_directory)
- WooCommerce: Add Payment Gateway Field to Webhooks [closed]
- Attaching a pdf to Contact Form 7 e-mail via functions.php [closed]
- Upload Image in a WordPress page using PHP
- How to add custom post meta to default blog post?
- Problem adding class to body_class
- Trying to implement Ajax comments in WordPress, getting WP error
- My form action url is being prepended with a directory that does not exists
- Remove price from Woocommerce variable product dropdown menu
- What is the intended purpose of the _wp_attachment_context post meta key?
- PHP Script for last login time
- WP_Query adds “(wp_posts.ID = ‘0’)” so no results are returned
- Changes in permalink structure in WordPress and how to apply to in-site links
- Ajax request not sending to server and returning – wp-admin/admin-ajax.php 400
- Why Won’t My Inputs in a form with a Get method work together?
- fatal error call to undefined function get_header in index.php on line 1
- Use of wp_insert_post and parameters
- WordPress theme options error
- Shortcode returns values in the wrong order
- Custom PHP App with a wordpress site
- WordPress wp_redirect error
- Using a $GET parameter from a URL, to redirect to a URL (WordPress)
- Is it possible to define variables in a wordpress shortcode, and then call the shortcode using a specific variable?
- Running rmdir function on post save
- PHP if statement works in template files, but not header
- Using WP functions such as the_title() in an included php file
- Issue with fetching mysql data and displaying results via shortcode in webpage
- PHP-warning in post-template.php and no loading content on pages
- class ‘wphpc_PAnD’ not found
- Creating an image from a custom field
- WordPress check if current taxonomy has child
- Is there a name for trivial WP PHP files like functions.php, archive php entry.php, page.php and so forth?
- Send notification email to admin for every new post published
- In WordPress, I want to run a loop to get posts in tabular format
- Automatically generator a WordPress installation on my subdomain
- custom stripe plugin
- Override index with a custom PHP page
- How do I correct the code in php? [closed]
- Dynamically adding filters
- Sorting users by a field, not by ID
- Edit Account – read and write to MySQL
- help with custom shortcode that stopped working
- Looping through 3 recent posts but separating them into separate divs
- How to SELECT number from table and use in calculation . Unsupported operand types
- Enqueueing a code block from an options framework
- Conditional On custom field plugin metabox
- Exclude function from running on a certain page
- Menu not styling. New menus functionality giving me a headache
- Site DOES NOT LOAD after 3.1 update
- Adding an “Upgrade Subscription” button to an Elementor page
- Jetengine Forms – Media upload path
- How To Get HTML Eelement From Another Page
- How can I edit the final HTML structure of the whole web page
- I am having an issue with this shortcode plugin.. Warning: Illegal string offset ‘title’
- how to use auth_redirect() redirect visitor to login page if they are not login when they click account and order page?
- Merge wp_get_post_terms
- Php cron job (wp-cron) not working
- Huge time to first byte on live site
- Posts in two different columns Bootstrap
- How to make a vote in the poll for registered users?
- Remove specific javascript when viewing page in Customizer?
- how to call other plugins once custom post has been inserted
- Wrapping shortcode content in a span or link
- Force CSV download with template_redirect
- Undefined variable & issue with smof_data
- Issue with search form admin panel after PHP migration
- Why I’m Not Having Access to “$_POST” Data Outside My AJAX Callback?
- How to add style in functions.php depending on conditions?
- Can not manually create a database ( db, user, pass ) for a plugin
- Are widget arguments always set inside My_Widget::widget()?
- How to fix blank pagination links?
- WordPress Rewrite Issue
- News and Featured image
- Add code only for blog posts
- Removing backstretch image from pages/posts
- Adding ID to a Listing but not inside WP_Query while
- PHP in WordPress?
- Where to place PHP for shortcodes
- Warning: Cannot modify header information (with a twist)
- How do I get Roboto Google Font to display normal font-style? [closed]
- on category page get name of category as a string
- How to include a php file in every post and page [duplicate]
- Create an if statement based on page_id
- Can you not edit the HTML and PHP of your WordPress without paying?
- how to Show BEFORE TEXT before in wordpress get_comment_meta [closed]
- Check user last login date
- Why does WordPress not send the user the email to add a password?