diff options
author | Francesco Rodriguez <lrodriguezsanc@gmail.com> | 2012-05-11 17:30:46 -0500 |
---|---|---|
committer | Francesco Rodriguez <lrodriguezsanc@gmail.com> | 2012-05-11 17:30:46 -0500 |
commit | a0b46b5f1b8b554f438dd4efcbd71274c34a5dae (patch) | |
tree | c5a4f85758fd9ea46b55dbb26e4a0b623dc497e3 /activesupport | |
parent | 53cc85fad3440d5817ecf7e0e8cd0c7ff3d9a062 (diff) | |
download | rails-a0b46b5f1b8b554f438dd4efcbd71274c34a5dae.tar.gz rails-a0b46b5f1b8b554f438dd4efcbd71274c34a5dae.tar.bz2 rails-a0b46b5f1b8b554f438dd4efcbd71274c34a5dae.zip |
added docs to String#to_datetime
Diffstat (limited to 'activesupport')
-rw-r--r-- | activesupport/lib/active_support/core_ext/string/conversions.rb | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/activesupport/lib/active_support/core_ext/string/conversions.rb b/activesupport/lib/active_support/core_ext/string/conversions.rb index c42163a2f0..050eea33ee 100644 --- a/activesupport/lib/active_support/core_ext/string/conversions.rb +++ b/activesupport/lib/active_support/core_ext/string/conversions.rb @@ -29,6 +29,12 @@ class String end end + # Converts a string to a DateTime value. + # + # "1-1-2012".to_datetime #=> Sun, 01 Jan 2012 00:00:00 +0000 + # "01/01/2012 23:59:59".to_datetime #=> Sun, 01 Jan 2012 23:59:59 +0000 + # "2012-12-13 12:50".to_datetime #=> Thu, 13 Dec 2012 12:50:00 +0000 + # "12/13/2012".to_datetime #=> ArgumentError: invalid date def to_datetime unless blank? date_values = ::Date._parse(self, false). |