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

GeorgeW's avatar

Date to Julian Format

Hello,

I have the following code:

 date = "12/19/2019"
 $date = Carbon::parse($event->data['date']);

I would like to convert this to a Julian Date

20001

I just cannot find anything to easily convert this to julian.

Thanks in advance.

0 likes
8 replies
GeorgeW's avatar

Thankyou for the links but that is creating a Julian Day not Date.

So todays Juian Date is 19336

I need to convert "12/19/2019" to 19336

or simple get the day number from the year so 336 for today

bobbybouwmann's avatar

I get the feeling that we're all googling for you, have tried googling this stuff yourself?

1 like
willvincent's avatar

Julian is simply the last two digits of the year and the day of the year, seems like it ought to be pretty easy to sort that out on your own with carbon and a little string manipulation

Carbon has a dayOfYear() getter...

GeorgeW's avatar
GeorgeW
OP
Best Answer
Level 1

@willvincent thats what i was looking for dayofyear, thanks for your help. And PS i had googled trying to find this!!

Please or to participate in this conversation.