Added compatibility for OSX (and BSD in general) to the script by selecting gdate of date if it exists.
Gdate needs to be installed for this to work (brew install coreutils)