sonic-pi

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

C++

Code. Music. Live.

DateAndTime::Zones#in_time_zone

Returns the simultaneous time in <tt>Time.zone</tt> if a zone is given or
if Time.zone_default is set. Otherwise, it returns the current time.

  Time.zone = 'Hawaii'        # => 'Hawaii'
  DateTime.utc(2000).in_time_zone # => Fri, 31 Dec 1999 14:00:00 HST -10:00
  Date.new(2000).in_time_zone  # => Sat, 01 Jan 2000 00:00:00 HST -10:00

This method is similar to Time#localtime, except that it uses <tt>Time.zone</tt> as the local zone
instead of the operating system's time zone.

You can also pass in a TimeZone instance or string that identifies a TimeZone as an argument,
and the conversion will be based on that zone instead of <tt>Time.zone</tt>.

  Time.utc(2000).in_time_zone('Alaska') # => Fri, 31 Dec 1999 15:00:00 AKST -09:00
  DateTime.utc(2000).in_time_zone('Alaska') # => Fri, 31 Dec 1999 15:00:00 AKST -09:00
  Date.new(2000).in_time_zone('Alaska')  # => Sat, 01 Jan 2000 00:00:00 AKST -09:00

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/date_and_time/zones.rb

Contribute

# Make a new branch

git checkout -b -your-name--update-docs-DateAndTime--Zones-in_time_zone-for-pr


# Commit to git

git add app/server/ruby/vendor/activesupport-7.0.6/lib/active_support/core_ext/date_and_time/zones.rbgit commit -m "better docs for DateAndTime::Zones#in_time_zone"


# Open pull request

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

hub fork

git push <your name> -your-name--update-docs-DateAndTime--Zones-in_time_zone-for-pr

hub pull-request


# Celebrate!