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

uniqueginun's avatar

PHP datetime format

Hello

in PHP how to natively format a date such as this without any library

2021-09-02T10:48:21.428Z
0 likes
6 replies
maclervil's avatar

date('Y-m-d H:i:s',strtotime('2021-09-02T10:48:21.428Z'));

maclervil's avatar

I dont' understand, Can you give me a real example ?

uniqueginun's avatar

yeah, it's .NET API that I'm consuming in non-laravel project and they asking for specific date format.

Snapey's avatar
Snapey
Best Answer
Level 122

it's ISO 8601 format. I suggest you just use Carbon

Please or to participate in this conversation.