How to Get Current Time in Milliseconds in PHP ? Last Updated : 23 Jul, 2025 Comments Improve Suggest changes Like Article Like Report In this article, we will see how to get the current time in milliseconds in PHP. There are mainly three methods to get the current time in milliseconds and they are the following: Table of Content Using microtime() functionUsing DateTime class with the format methodUsing date_create() function with the format methodApproach 1: Using microtime() FunctionThe microtime() function in PHP gets the current time in seconds. We can simply multiply the resultant value by 1000 to convert the current time from seconds to milliseconds. Example: PHP <?php $current_time = round(microtime(true) * 1000); echo $current_time; ?> Output1704135351653 Approach 2: Using DateTime Class with format() FunctionThe DateTime class in conjunction with the format() function directly returns the current time in milliseconds with the Uv parameter. Example: PHP <?php $current_time = (new DateTime())->format('Uv'); echo $current_time; ?> Output1704135453553 Approach 3: Using date_create() with format() FunctionThe date_create() class, which returns a new DateTime class object, in conjunction with the format method returns the current time in milliseconds with the Uv parameter. Example: PHP <?php $current_time = date_create()->format('Uv'); echo $current_time; ?> Output1704135512433 Comment R rajatsandhu2001 Follow 0 Improve R rajatsandhu2001 Follow 0 Improve Article Tags : PHP PHP-date-time Geeks Premier League 2023 Explore PHP Tutorial 8 min read BasicsPHP Syntax 4 min read PHP Variables 5 min read PHP | Functions 8 min read PHP Loops 4 min read ArrayPHP Arrays 5 min read PHP Associative Arrays 4 min read Multidimensional arrays in PHP 5 min read Sorting Arrays in PHP 4 min read OOPs & InterfacesPHP Classes 2 min read PHP | Constructors and Destructors 5 min read PHP Access Modifiers 4 min read Multiple Inheritance in PHP 4 min read MySQL DatabasePHP | MySQL Database Introduction 4 min read PHP Database connection 2 min read PHP | MySQL ( Creating Database ) 3 min read PHP | MySQL ( Creating Table ) 3 min read PHP AdvancePHP Superglobals 6 min read PHP | Regular Expressions 12 min read PHP Form Handling 4 min read PHP File Handling 4 min read PHP | Uploading File 3 min read PHP Cookies 9 min read PHP | Sessions 7 min read Like