- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
gettimeofday() function in PHP
The gettimeofday() function returns an array that contains current time information.
Syntax
gettimeofday(return_float)
Parameters
return_float − When set to TRUE, a float instead of an array is returned.
Return
The gettimeofday() function returns an associative array by default. The following are the returned array keys
[sec] − seconds since the Unix Epoch
[usec] − microseconds
[minuteswest] − minutes west of Greenwich
[dsttime] − type of dst correction
Example
The following is an example −
<?php print_r(gettimeofday()); ?>
Output
Array ( [sec] => 1539234547 [usec] => 322766 [minuteswest] => 0 [dsttime] => 0 )
Example
The following is an example −
<?php echo gettimeofday(true); ?>
Output
1539172203.5542
Example
The following is an example
<?php $res = gettimeofday(); echo "$res[sec].$res[usec]"; ?>
Output
1539172298.346375
Advertisements