PHP date microseconds

PHP date microseconds


Posted in : PHP Posted on : January 29, 2011 at 6:29 PM Comments : [ 0 ]

In this tutorial you will learn how to find PHP date with microseconds in a PHP web application .

PHP date microseconds

In this tutorial you will learn how to find PHP date with microseconds in a PHP web application . In this tutorial  calculate  current  date  with microseconds. The code of  "php-date-microseconds.php"  given below :

<?php
$time =microtime(true);
$micro_time=sprintf("%06d",($time - floor($time)) * 1000000);
$date=new DateTime( date('Y-m-d H:i:s.'.$micro_time,$time) );
print "Date with microseconds :<br> "
.$date->format("Y-m-d H:i:s.u");
?>

Output :

When run "php-date-microseconds.php"  display output as :

Download Source Code

Go to Topic «PreviousHomeNext»

Your Comment:


Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image
 
 

 
Tutorial Topics