Skip to content

Instantly share code, notes, and snippets.

@shibaku
Created February 23, 2016 14:08
Show Gist options
  • Save shibaku/75fb8f428954a7b35bae to your computer and use it in GitHub Desktop.
Save shibaku/75fb8f428954a7b35bae to your computer and use it in GitHub Desktop.
set thisYear to do shell script "date '+%Y'"
set thisMonth to do shell script "date '+%m'"
set lastMonth to do shell script "date -v -1m '+%m'"
set thisDay to do shell script "date '+%d'"
(If I'm processing reports at the end of the month, use current month for file name. If not, use last month. *)
if thisDay > 20 then
set myDate to thisYear & "-" & thisMonth
else
set myDate to thisYear & "-" & lastMonth
end if
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment