Class: DBI::DBD::Mysql::Type::Date

### Home Classes Methods

### In Files

- lib/dbd/Mysql.rb

### Parent

DBI::Type::Null

### Methods

- ::parse

### Files

- ChangeLog
- LICENSE
- README

### Class/Module Index

Quicksearch

- DBI
- DBI::DBD
- DBI::DBD::Mysql
- DBI::DBD::Mysql::Database
- DBI::DBD::Mysql::Driver
- DBI::DBD::Mysql::Statement
- DBI::DBD::Mysql::Type
- DBI::DBD::Mysql::Type::Date
- DBI::DBD::Mysql::Util

No matching classes.

# DBI::DBD::Mysql::Type::Date

Custom handling for DATE types in MySQL. See DBI::Type for more information.

### Public Class Methods

parse(obj) click to toggle source

    # File lib/dbd/Mysql.rb, line 117
    def self.parse(obj)
        obj = super
        return obj unless obj

        case obj.class
        when ::Date
            return obj
        when ::String
            return ::Date.strptime(obj, "%Y-%m-%d")
        else
            return ::Date.parse(obj.to_s)   if obj.respond_to? :to_s
            return ::Date.parse(obj.to_str) if obj.respond_to? :to_str
            return obj
        end
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.