How to get the time of the last modification of the current page in PHP? Last Updated : 08 Mar, 2021 Comments Improve Suggest changes Like Article Like Report Sometimes, we need to get the last modification time of the current page in PHP for different uses. Since we are using PHP, we can easily get the last modification time of the current page by using getlastmod() PHP function. Using getlastmod() Function: The getlastmod() function is used to get the last modification time of the current page. This function is easy and powerful. Syntax: $last_modification="Last modified on: " . date ("F d Y H:i:s.", getlastmod()); Example :The following is the complete code to get and show the last modification time of the current page. PHP <?php // To Get the last modification time. $last_modification="Last modified: " . date ("F d Y H:i:s.", getlastmod()); // To Show the last modification time. echo $last_modification; ?> Output Last modified: February 25 2021 12:40:34. Note: We can directly use it as the following. echo "Last modified: " . date ("F d Y H:i:s.", getlastmod()); Using filemtime() Function: The filemtime() function in PHP is an inbuilt function that is used to return the last time of a specified file when its content was modified. Example: PHP <?php // checking last time the contents // of a file were changed echo filemtime("index.html.txt"); // checking last time the contents of // a file were changed and formatting // the output of the date echo "Last modified: ".date("F d Y H:i:s.", filemtime("index.html")); ?> Output: Last modified: February 13 2021 13:01:35. Comment More infoAdvertise with us Next Article How to get the time of the last modification of the current page in PHP? I iamjatinkumar Follow Improve Article Tags : Web Technologies PHP PHP-date-time PHP-Questions Similar Reads How to get file creation and modification date or time in Python? We often need to access various file properties for different purposes. Among the file properties, the creation and modification time of a file are the most commonly used ones. We can achieve the same functionality and use it for various utility purposes, using multiple methods. You can use function 4 min read How to get Time Difference in Minutes in PHP ? In this article, we will learn how to get time difference in minutes using PHP. We will be using the built-in function date_diff() to get the time difference in minutes. For this, we will be needed a start date and end date to calculate their time difference in minutes using the date_diff() function 3 min read How to Get the Timestamp in JavaScript? A timestamp is a numeric representation of the current time. It is a unique identifier that marks the exact moment when an event occurred or when a certain action was performed. 1. Using Date.now() MethodThis approach uses Date.now() method. This method returns the number of milliseconds since Janua 2 min read How to change the session timeout in PHP? In PHP, sessions are maintained to check if the user is active. When the user becomes inactive and the user forgets to logout from the web page, there is a chance of other users viewing the page causing security breach. By default, a session in PHP gets destroyed when the browser is closed. Session 2 min read How to Get Last Modified Date of File in Linux? Here we are going to see how to get the last modified date of the file in Linux, sometimes we may require timestamps of the file and apart from this it also ensures that we have the latest version of that file. It can be done in four ways: Using Stat command.Using date command.Using ls -l command.Us 1 min read Like