How to convert strtotime value to date in php?

How to convert strtotime value to date in php?

Let’s say you want to do a strtotime to the current date:

1
2
3
4
5
6
7
<html>
<?php
 
$time = time();
 
echo $time;
?>

This will echo the strtotime value for the current date (today).

To convert the value to a date, use this code:

2
3
4
5
6
7
8
9
10
11
<html>
<?php
 
$time = time();
 
$date = date('d.m.Y', $time);
 
echo ''.$date.'';
 
?>

Add a comment: