Skip to content

sql-timestamp fails on long, expecting int #10

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
rplevy opened this issue Jun 27, 2017 · 2 comments
Closed

sql-timestamp fails on long, expecting int #10

rplevy opened this issue Jun 27, 2017 · 2 comments
Assignees
Labels
Milestone

Comments

@rplevy
Copy link

rplevy commented Jun 27, 2017

sql-timestamp now fails on trying to convert a long to an integer:
e.g. (time/sql-timestamp 1498582624546) results in Value out of range for int: 1498582624546

In a previous version, 0.2.2, the expected behavior for longs was in place, but it was lost when I upgrade to 0.3.0. The actual regression may have been introduced in an earlier version, that is just the version I upgraded to as it is presently the latest release.

@dm3
Copy link
Owner

dm3 commented Jun 27, 2017

@rplevy - sorry, seems I've changed to-sql-timestamp as well as to-sql-date but didn't mention the former one in the breaking changes for 0.3.0.

You can still get a sql-timestamp out of an epoch millis by doing:

(j/sql-timestamp (j/local-date-time (j/instant 1498582624546) (j/zone-id))))

Be aware that sql-timestamp uses java.sql.Timestamp/valueOf which will use the default timezone of the JVM to remove the offset, hence the (j/zone-id) above.

I'll think on how to allow going from Instant -> sql.Timestamp.

EDIT: mentioned the breaking change in the CHANGELOG

@dm3 dm3 self-assigned this Jun 27, 2017
@dm3 dm3 added the bug label Jun 27, 2017
@dm3 dm3 added this to the 0.3.1 milestone Jun 27, 2017
@dm3 dm3 modified the milestones: 0.3.2, 0.3.1 Aug 16, 2017
@dm3
Copy link
Owner

dm3 commented Dec 27, 2017

Added instant->sql-timestamp to construct a java.sql.Timestamp out of an instant/long.

@dm3 dm3 closed this as completed Dec 27, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants