sonic-pi

https://github.com/sonic-pi-net/sonic-pi

C++

Code. Music. Live.

String#to_datetime

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

Source | Google | Stack overflow

Edit

git clone [email protected]:sonic-pi-net/sonic-pi.git

cd sonic-pi

open app/server/ruby/vendor/activesupport-7.0.6/lib/active_support/core_ext/string/conversions.rb

Contribute

# Make a new branch

git checkout -b -your-name--update-docs-String-to_datetime-for-pr


# Commit to git

git add app/server/ruby/vendor/activesupport-7.0.6/lib/active_support/core_ext/string/conversions.rbgit commit -m "better docs for String#to_datetime"


# Open pull request

gem install hub # on a mac you can `brew install hub`

hub fork

git push <your name> -your-name--update-docs-String-to_datetime-for-pr

hub pull-request


# Celebrate!