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

monstajamss's avatar

How To Get Current Time

I want to get the current time using this format YYYY-MM-DDTHH:mm:ss.zzz and i am not sure what it is.

0 likes
3 replies
sos99's avatar

so play with tinker until you get what you want.

thinkverse's avatar

Is this for the format you're looking for? πŸ€”

now()->format('Y-m-d\TH:i:s.z'); // 2022-07-27T17:48:09.207
Niush's avatar

You have labeled forge, so for bash something like this might match:

date '+%Y-%m-%dT%H:%M:%S.%Z'

Could also be lowercase %z at the end.

Please or to participate in this conversation.