Home > database >  Prisma DateTime format ( ISO 8601) changes to weird number
Prisma DateTime format ( ISO 8601) changes to weird number

Time:01-21

I use Prisma DateTime model field as it provides to get createdAt. So it automatically stamped ISO 8601 format on my db.

2022-01-20T12:01:30.543Z

But when I console.log this data on my app, it changes to weird number like 1642680090542.

What kind of number is this?

And How can I change it to normal date?

CodePudding user response:

Thats the date in milliseconds. When you receive this, you can convert it to date again like:

var date = new Date(1642680090542);
console.log(date)
  •  Tags:  
  • Related