Friday, October 17, 2025
HomeLanguagesConvert timestamp to readable date/time in PHP

Convert timestamp to readable date/time in PHP

Problem: Convert timestamp to readable date/time in PHP
Solution: This can be achieved with the help of date() function, which is an inbuilt function in PHP can be used to format the timestamp given by time() function. This function returns a string formatted according to the given format string using the given integer timestamp or the current time if no timestamp is given.

Example 1:




<?php
echo date('m/d/Y H:i:s', 1541843467);
?>


Output:

11/10/2018 09:51:07

Example 2:




<?php
echo date('m/d/Y H:i:s', time());
?>


Output:

Current Time in formatted form

Reference: http://php.net/manual/en/function.date.php

PHP is a server-side scripting language designed specifically for web development. You can learn PHP from the ground up by following this PHP Tutorial and PHP Examples.

Dominic
Dominichttp://wardslaus.com
infosec,malicious & dos attacks generator, boot rom exploit philanthropist , wild hacker , game developer,
RELATED ARTICLES

Most Popular

Dominic
32361 POSTS0 COMMENTS
Milvus
88 POSTS0 COMMENTS
Nango Kala
6728 POSTS0 COMMENTS
Nicole Veronica
11892 POSTS0 COMMENTS
Nokonwaba Nkukhwana
11954 POSTS0 COMMENTS
Shaida Kate Naidoo
6852 POSTS0 COMMENTS
Ted Musemwa
7113 POSTS0 COMMENTS
Thapelo Manthata
6805 POSTS0 COMMENTS
Umr Jansen
6801 POSTS0 COMMENTS