Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

Abdullah_Iftikhar's avatar

DateTime @1589504400 {#385 ▼ date: 2020-05-15 01:00:00.0 +00:00 } get time?

I want to get the time in AM or PM from Carbon::parse() result?

0 likes
2 replies
bobbybouwmann's avatar

Try this

Carbon::now()->format('g:i A'); // 10:53 AM
Carbon::now()->addHours(10)->format('g:i A'); // 8:53 PM
MichalOravec's avatar
Carbon::parse('2020-05-12T19:40:45Z')->format('d-m-y h:i A');

Please or to participate in this conversation.