New function: Utilities.parseDate()

1,435 views
Skip to first unread message

Andrew Roberts

unread,
Nov 13, 2022, 6:04:24 AM11/13/22
to Google Apps Script Community
I think this newly released function is worth highlighting for those of us who forget to keep an eye on the Apps Script release notes!

parseDate(date, timeZone, format) 

Parses the provided string date according to the specification described in the Java Standard Edition SimpleDateFormat class. For more information, see the Java SimpleDateFormat class.

// This set of parameters parses the given string as a date in Greenwich Mean Time, formatted
// as year-month-dateThour-minute-second.
var date = Utilities.parseDate("1970-01-01 00:00:00", "GMT", "yyyy-MM-dd' 'HH:mm:ss");
Logger.log(date);

I had spent many an hour putting together functions like this - DateTime - and this pulls them all together nicely!


Andrew Roberts

unread,
Nov 13, 2022, 6:06:19 AM11/13/22
to Google Apps Script Community
Oh and here are the release notes if interested.

CBMServices Web

unread,
Nov 13, 2022, 12:31:00 PM11/13/22
to google-apps-sc...@googlegroups.com
Thanks Andrew. Nice to know.

--
You received this message because you are subscribed to the Google Groups "Google Apps Script Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-apps-script-c...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-apps-script-community/894b04a6-66f2-4917-b130-6764d7547152n%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages