-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
  • 25,115
  • 5
  • 19
  • 43
Ville
  • 93
  • 1
  • 2
  • 7

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
  • 25,115
  • 5
  • 19
  • 43