Skip to content

Instantly share code, notes, and snippets.

@seabre
Created September 16, 2011 18:21
Show Gist options
  • Save seabre/1222746 to your computer and use it in GitHub Desktop.
Save seabre/1222746 to your computer and use it in GitHub Desktop.
Get Datetime in the Currently Set Timezone in Rails for the Beginning of the Next Month
#Get datetime for the beginning of the next month in the timezone that's currently set.
one_month_ahead = Time.zone.now.at_beginning_of_month.next_month
#You can format the datetime the way you want as well.
one_month_ahead = Time.zone.now.at_beginning_of_month.next_month.strftime("%Y-%m-%d %T %z")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment