Command to get amount of days since date

Hello all and happy Halloween, on my stream we have a running joke that it’s the same persons birthday every single day. I’d like to create some sort of command in which when it’s triggered it wishes said person a happy 228th birthday (if it were executed today) a happy 230th birthday if it were executed in 2 days from now ecr.

Thanks in advance

Hey @Jordan_Lee!

Since you haven’t given a start date, I’ve guessed it from the time of your post and the amount of days it’s been since, I came up with 2023-03-17 (yyyy-mm-dd), feel free to update the date in the code if necessary, but make sure to follow the yyyy-mm-dd format.

$(eval today = new Date(); startDate = new Date('2023-03-17'); diff = Math.trunc((today - startDate) / 1000); daysDiff = Math.floor(diff / 86400); `Happy ${daysDiff}th birthday, USERNAME!`;)

Don’t forget to edit the USERNAME field.

:warning: There might be a slight offset of a couple hours since the command works in the UTC timezone.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.