-2

I have timestamps in array like this: 20221206235959

If I do this:

$start_time = $book->booking_start;
echo (date('F j, Y',$start_time));

Result is: July 1, 642735

How can I change it to something like this: 06.12.2022 23:59:59 ?

Zhorov
  • 28,486
  • 6
  • 27
  • 52
Ville
  • 105
  • 2
  • 2
  • 8

1 Answers1

2

I think you need to parse and format the input datetime value:

<?php
$start_time = '20221206235959';
echo DateTime::createFromFormat('YmdHis', $start_time)->format("d.m.Y H:i:s");
?>

Result:

06.12.2022 23:59:59
Zhorov
  • 28,486
  • 6
  • 27
  • 52