I have a problem in extracting time from $timestamp which something looks like
this $timestamp = "2017-05-03 11:47:48";
my question is: how to extract time from above $timestamp like this 11:47 AM
my current time zone is Asia/Kolkata
First make sure you installed carbon, refer to https://github.com/briannesbitt/Carbon.
$timestamp = "2017-05-03 11:47:48";
$date = Carbon::createFromFormat('Y-m-d H:i:s', '2017-05-03 11:47:48', 'Asia/Kolkata');
echo $date->format("H:i A");
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With