Created
September 7, 2010 07:12
-
-
Save kjwierenga/567985 to your computer and use it in GitHub Desktop.
Determine yesterday's date (yesterdate) in ruby or shell (linux and OSX)
This file contains hidden or 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
> date -d-1day | |
Mon Sep 6 09:08:43 CEST 2010 | |
> date -d-1day +%Y%m | |
201009 |
This file contains hidden or 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
> date -v-1d | |
ma 6 sep 2010 09:10:00 CEST | |
> date -v-1d +%Y%m | |
201009 |
This file contains hidden or 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
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