Timestamp To Date Converter
Convert timestamp to date or date to timestamp easily
How To Get Current Timestamp In PHP
There is multiple ways how to get current timestamp in PHP.
Using function time
Function time
returns current Unix timestamp (number of seconds since the Unix Epoch (January 1 1970 00:00:00 GMT).
echo time();
# 1728041824
Using function microtime
Function microtime
returns current Unix timestamp with microseconds.
echo microtime(true);
# 1728041824.0374
Using class DateTime
Class DateTime
provides an object oriented approach for date and time manipulation.
$d1 = new Datetime();
echo $d1->format('U');
# 1728041824
$d2 = new Datetime("now");
echo $d2->format('U');
# 1728041824
Tags
Related Articles
- How To Get Current Timestamp In Bash
- How To Get Current Timestamp In Java
- How To Get Current Timestamp In JavaScript
- How To Get Current Timestamp In Python
- How To Convert Timestamp To Date and Time in JavaScript
- How To Convert Timestamp To Date and Time in Python
- How To Get Current Date And Time in JavaScript
- How To Get Current Time In Python