Class: DB::Postgres::Native::Types::Date
- Inherits:
-
Object
- Object
- DB::Postgres::Native::Types::Date
- Defined in:
- lib/db/postgres/native/types.rb
Overview
A date type converter.
Instance Method Summary collapse
-
#name ⇒ Object
Get the SQL type name for date.
-
#parse(string) ⇒ Object
Parse a date value from the database.
Instance Method Details
#name ⇒ Object
Get the SQL type name for date.
156 157 158 |
# File 'lib/db/postgres/native/types.rb', line 156 def name "DATE" end |
#parse(string) ⇒ Object
Parse a date value from the database.
163 164 165 166 167 168 169 |
# File 'lib/db/postgres/native/types.rb', line 163 def parse(string) if string parts = string.split(/[\-\s:]/) return Time.utc(*parts) end end |