Last active
January 16, 2019 18:28
-
-
Save phillypb/5e96388526aa6e5fab5b986ca9d8d1ac to your computer and use it in GitHub Desktop.
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
| function organiseDate() { | |
| // example date string | |
| var messyDate = 'Thu Dec 20 2018 13:12:21 GMT-0000 (GMT)'; | |
| // create a new date variable | |
| var newDate = new Date(messyDate); | |
| // format the new date variable as required | |
| var niceDate = Utilities.formatDate(newDate, "GMT", "YYYY_MM_dd"); | |
| // log output | |
| Logger.log(niceDate); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment