I need to print result of function date('d-m-y H:i:s', $time)
on two lines like this:
26-11-2019
10:00:02
I try to add <br/>
between 'd-m-y' AND 'H:i:s' doesn't help.
Try this:
echo nl2br(date("d-m-y\nH:i:s", $time));
Note that I used double quotes instead of single quotes. This is because \n won't work with single quotes. For your reference: https://www.php.net/manual/en/function.nl2br.php What is the difference between single-quoted and double-quoted strings in PHP?
You can use simple PHP date function with escape sequences <\b\r>
echo date('d-m-y <\b\r>H:i:s');
Output
27-11-19
00:45:55
Referance: How to add <br> tag in PHP Date format
Try like this may it will help.
!DOCTYPE html>
<html>
<body>
<?php
echo date('d-m-y', $time) . "<br>" . date('H:i:s', $time)
?>
</body>
<html>
date('H:i:s', $time) – mdBender Nov 27 '19 at 05:28
".date('H:i:s'); – Prabhjot Singh Kainth Nov 27 '19 at 05:35