Please note, this is a STATIC archive of website www.tutorialspoint.com from 11 May 2019, cach3.com does not collect or store any user information, there is no "phishing" involved.
Tutorialspoint

PHP Function strptime()

<?php
   $format = '%d/%m/%Y %H:%M:%S';
   $strf = strftime($format);
   
   echo "$strf\n";
   
   print_r(strptime($strf, $format));
?>

PHP Function strftime()

<?php
   setlocale(LC_TIME, 'en_US');
   
   echo strftime("%b %d %Y %H:%M:%S", mktime(20, 0, 0, 12, 31, 2015)) . "\n";
   echo gmstrftime("%b %d %Y %H:%M:%S", mktime(20, 0, 0, 12, 31, 2015)) . "\n";
?>

PHP Function mktime()

<?php
   $lastday = mktime(0, 0, 0, 3, 0, 2010);
   echo strftime("Last day in Feb 2010 is: %dn", $lastday);
   
   $lastday = mktime(0, 0, 0, 4, -31, 2010);
   echo strftime("Last day in Feb 2010 is: %d", $lastday);
?>

PHP Function microtime()

<?php
   $time_start = microtime(true);
   usleep(100);
   
   $time_end = microtime(true);
   $time = $time_end - $time_start;
   
   echo "Did nothing in $time seconds\n";
?>

PHP Function localtime()

<?php
   $localtime = localtime();
   $localtime_assoc = localtime(time(), true);
   
   print_r($localtime);
   print_r($localtime_assoc);
?>

PHP Function idate()

<?php
   $timestamp = strtotime('1st January 2014');
   
   echo idate('y', $timestamp);
   echo"\n";
   echo idate('t', $timestamp);
?>

PHP Function gmstrftime()

<?php
   setlocale(LC_TIME, 'en_US');
   
   echo strftime("%b %d %Y %H:%M:%S", mktime(20, 0, 0, 12, 31, 2015)) . "\n";
   echo gmstrftime("%b %d %Y %H:%M:%S", mktime(20, 0, 0, 12, 31, 2015)) . "\n";
?>

PHP Function gmmktime()

<?php
   $time = gmmktime(0,0,0,8,6,1971);
   
   print($time . "\n");
?>

PHP Function gmdate()

<?php
   echo date("M d Y H:i:s", mktime(0, 0, 0, 1, 1, 2017));
   echo gmdate("M d Y H:i:s", mktime(0, 0, 0, 1, 1, 2017));
?>

PHP Function gettimeofday()

<?php
   print_r(gettimeofday());
   
   echo gettimeofday(true);
?>

Advertisements
Loading...

We use cookies to provide and improve our services. By using our site, you consent to our Cookies Policy.