#Wrong datetime in database
15 messages · Page 1 of 1 (latest)
I'm having the same problem with the "America/Sao_Paulo" (UTC -3) time zone, if you find an answer, could you please answer me?
alright!
Check out @db.Timestamptz(x)
@coral willow what version you use of prisma? This version 5.0.0 have a problem with datetime. I went back to 4.17.0-dev.61 and it works correctly
Well, with the version you told me the time is advanced by 30 minutes 😂
I saw that it only worked on one of my tables, the others were the same and with the same configuration. the prism actually has a datetime deficit
😂
@coral willow Hello bro, I solved this error/bug with this table model:
createdAt DateTime @default(dbgenerated("CURRENT_TIMESTAMP(0)")) @db.DateTime(0)
When using "now()" in place of "dbgenerated("CURRENT_TIMESTAMP(0)")", this doesn't work
I'm use the 4.0.0 version to test, now i will update
Ohhh man this works in version 5.0.0, thanks, you rock !!
You welcome bro!
I'm in trouble running Prisma 5.4.2 with MySQL 8.1: DateTime works fine with dates in the past or close to the year, but rejects dates in the future. Example:
ConnectorError(ConnectorError { user_facing_error: None, kind: QueryError(Server(ServerError { code: 1292, message: "Incorrect datetime value: '2041-12-05 04:00:00.000' for column 'xxx' at row 1", state: "22007" })), transient: false })
log.ts:84
Note the year: 2041... just replacing it by 2037 works fine.
The database field type is timestamp and it´s define as @db.Timestamp(3) in my schema.