marcus-linmarkson
marcus-linmarkson

Reputation: 363

Extra word between date and time with date-fns

I am looking for a way to add an extra word between the date and time in date-fns library, but couldn't find such format. Right now I am using format function with MMM d hh:mm aa format.

The outcome is: Nov 15 10:00 PM

Is there a way to get: Nov 15 at 10:00 PM

Upvotes: 2

Views: 476

Answers (1)

Ben S
Ben S

Reputation: 568

I'd highly recommend reading and understanding the docs, before posting a question as simple as this.

As per documentation for the latest version (as of writing 2.29.3) the following will yield the required result.

format(new Date("Sep 2 2020 13:00"), "MMM dd 'at' HH:MM a")

Upvotes: 2

Related Questions