0

Several functions in Google Scripts for Adwords supports the following date range strings:

TODAY, YESTERDAY, LAST_7_DAYS, THIS_WEEK_SUN_TODAY, LAST_WEEK, LAST_14_DAYS, LAST_30_DAYS, LAST_BUSINESS_WEEK, LAST_WEEK_SUN_SAT, THIS_MONTH, LAST_MONTH, ALL_TIME

One would think that the functions you pass the strings to were able to convert those strings to a start and end date. For instance, LAST_MONTH would be converted to start date 2013-02-01 and end date 2013-02-28, and TODAY would be converted to start- and end date 2013-03-01.

Does Google Scripts also provide a way for users to parse those strings into a start and end date?

j0k
  • 22,600
  • 28
  • 79
  • 90
Hubro
  • 56,214
  • 69
  • 228
  • 381

1 Answers1

0

I asked this same question on Google Groups (here is the answer.). To summarize, there is no public method for achieving this in Google Scripts, and a custom solution has to be deployed. Since I'm exporting the Adwords data to a personal database anyway I'll be solving this using PHP, so I won't be posting a solution here.

Hubro
  • 56,214
  • 69
  • 228
  • 381
  • Well, why not? Beyond the fact that you could basically lowercase it, replace with underscore with a space and then pass it to `strtotime` given that you're using PHP... – Charles Mar 22 '13 at 17:29
  • @Charles Well, `strtotime` converts strings to single points in time, but I need them converted to time spans (a start and end date.) – Hubro Mar 22 '13 at 20:23