In PHP, the time() function can be used with the date() function to get what time it is currently. When the parameters of the date() function are set to "'h:i:s'", you can Get the current time, the syntax is "date('h:i:s', time());".
The operating environment of this article: Windows 10 system, PHP version 7.1, Dell G3 computer.
How to get the current time in php
The time() function returns the number of seconds of the current time since the Unix epoch (January 1 1970 00:00:00 GMT).
The syntax is:
time();
Return value:
Returns an integer containing the Unix timestamp of the current time.
date() function is used to format time/date.
The date() function formats the timestamp into a more readable date and time.
Syntax
string date ( string $format [, int $timestamp ] )
Parameter Description
format Required. Specifies the format of the timestamp.
timestamp Optional. Specify timestamp. The default is the current date and time.
The example is as follows:
<?php echo date('h:i:s', time()); ?>
The output result is the current time
Recommended study:《 PHP video tutorial》
The above is the detailed content of How to get the current time in php. For more information, please follow other related articles on the PHP Chinese website!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

WebStorm Mac version
Useful JavaScript development tools

SublimeText3 Linux new version
SublimeText3 Linux latest version

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Atom editor mac version download
The most popular open source editor

Dreamweaver CS6
Visual web development tools
