sonic-pi

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

C++

Code. Music. Live.

String#to_time

Converts a string to a Time value.
The +form+ can be either :utc or :local (default :local).

The time is parsed using Time.parse method.
If +form+ is :local, then the time is in the system timezone.
If the date part is missing then the current date is used and if
the time part is missing then it is assumed to be 00:00:00.

  "13-12-2012".to_time               # => 2012-12-13 00:00:00 +0100
  "06:12".to_time                    # => 2012-12-13 06:12:00 +0100
  "2012-12-13 06:12".to_time         # => 2012-12-13 06:12:00 +0100
  "2012-12-13T06:12".to_time         # => 2012-12-13 06:12:00 +0100
  "2012-12-13T06:12".to_time(:utc)   # => 2012-12-13 05:12:00 UTC
  "12/13/2012".to_time               # => ArgumentError: argument out of range

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_time-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_time"


# 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_time-for-pr

hub pull-request


# Celebrate!