Skip to content

Commit

Permalink
Stop using ParseDate on DB2 as well
Browse files Browse the repository at this point in the history
  • Loading branch information
nicksieger committed Dec 19, 2011
1 parent 1fb36a2 commit 5257e2f
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/arjdbc/db2/adapter.rb
Expand Up @@ -69,7 +69,9 @@ def self.cast_to_date_or_time(value)
def self.cast_to_time(value)
return value if value.is_a? Time
# AS400 returns a 2 digit year, LUW returns a 4 digit year, so comp = true to help out AS400
time_array = ParseDate.parsedate(value, true)
time = DateTime.parse(value).to_time rescue nil
return nil unless time
time_array = [time.year, time.month, time.day, time.hour, time.min, time.sec]
time_array[0] ||= 2000; time_array[1] ||= 1; time_array[2] ||= 1;
Time.send(ActiveRecord::Base.default_timezone, *time_array) rescue nil
end
Expand Down

0 comments on commit 5257e2f

Please sign in to comment.