Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Add documentation about how Time/Date is handled in Sequel #585

Closed
dlee opened this Issue · 1 comment

2 participants

@dlee

Databases have various datatypes that store time and date. Is there documentation about how Sequel deals with those data types?

I can't find anywhere in the documentation that tells you how time zones are handled, for example. Do timestamp with timezone types maintain their timezone in Ruby land? If not, how are they converted? How are timestamp without timezone types converted to Ruby Time/DateTime?

@jeremyevans
Owner

I don't think there is any specific documentation on this issue, and I'm not sure it's worth adding. If you feel strongly about the issue, please submit a pull request.

Not all databases support timezones in their timestamp types, and for those that do, they may not actually store the timezone. PostgreSQL at least converts everything to UTC internally, so if you put in a timestamp with +0600, you generally do not get a timestamp back with +0600 unless that is the local timezone for the retrieving client (though whatever value you get will be equivalent).

How timestamp types are converted upon retrieval depends on the underlying driver. If the driver returns the type as a string, Sequel will attempt to convert it using Time/DateTime.parse. In generally, timestamp with timezone and timestamp without timezone are treated the exact same way by Sequel, though the database treats the types differently.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.