Skip to content

Instantly share code, notes, and snippets.

@kjwierenga
Created September 7, 2010 07:12
Show Gist options
  • Save kjwierenga/567985 to your computer and use it in GitHub Desktop.
Save kjwierenga/567985 to your computer and use it in GitHub Desktop.
Determine yesterday's date (yesterdate) in ruby or shell (linux and OSX)
> date -d-1day
Mon Sep 6 09:08:43 CEST 2010
> date -d-1day +%Y%m
201009
> date -v-1d
ma 6 sep 2010 09:10:00 CEST
> date -v-1d +%Y%m
201009
require 'date'
puts (Date.today-1).strftime("%Y%m")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment