Skip to content
This repository has been archived by the owner on Jan 19, 2022. It is now read-only.

java.util.Date should not be converted to spanner Date type #2067

Closed
dmitry-s opened this issue Dec 3, 2019 · 4 comments · Fixed by #2070
Closed

java.util.Date should not be converted to spanner Date type #2067

dmitry-s opened this issue Dec 3, 2019 · 4 comments · Fixed by #2070
Assignees

Comments

@dmitry-s
Copy link
Contributor

dmitry-s commented Dec 3, 2019

java.util.Date represents an instant in time, with millisecond precision, while Spanner Date represents a date without time.

@ayancancode
Copy link

ayancancode commented Dec 4, 2019

java.util.Date represents an instant in time, with millisecond precision, while Spanner Date represents a date without time.

So, we have to use Timestamp as a column in spanner Database for java.util.Date in Entity and we are forced to use com.google.cloud.Date as a type in Entity if we want to put column type as Date. Please let me know if my understanding is correct. I guess this is the current condition after current patch for Timestamp fix.

@meltsufin
Copy link
Contributor

LocalDateTime seems to be the perfect match for the Spanner DATE. Both are just dates with no timezone.

@ayancancode
Copy link

ayancancode commented Dec 5, 2019

Thanks @meltsufin . I guess that makes sense. But, Spanner date represents a logical calendar date. LocalDate makes more sense to me in terms of perfect match. What do you think?

@meltsufin
Copy link
Contributor

@ayancancode You're absolutely right, I meant to say LocalDate.

@meltsufin meltsufin added the P1 label Dec 5, 2019
dmitry-s added a commit that referenced this issue Dec 7, 2019
* fix date conversion; fixes #2067
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Development

Successfully merging a pull request may close this issue.

3 participants