Created
August 30, 2010 02:33
-
-
Save d2kagw/556938 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class IndexController < ApplicationController | |
# Monday - Friday | |
# | |
# Session 1 | |
# Pacific: 8am-12pm | |
# GMT: 3pm-7pm | |
# | |
# Session 2 | |
# Pacific: 4pm-8pm | |
# GMT: 11pm-3am | |
def index | |
# is it monday - friday? | |
if DateTime.now.wday > 0 && DateTime.now.wday < 6 | |
# it's monday - friday | |
# is the time in the two sessions? | |
if (DateTime.now.hour >= 8 && DateTime.now.hour <= 12) || (DateTime.now.hour >= 16 && DateTime.now.hour <= 20) | |
@active = "Yes" | |
else | |
# it's out of sessions | |
@active = "No" | |
end | |
else | |
# it's the weekend | |
@active = "No" | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment