Hi, The exception below indicates that you simply imported the wrong *DateRange* class. If you are using Axis then you'll want to import the following:
com.google.api.ads.adwords.axis.v201309.cm.DateRange As an aside, your constructor call for *SimpleDateFormat* looks incorrect. You should pass a string reflecting the desired format rather than the date itself. My recommendation would be to switch to using Joda time's DateTime class<http://joda-time.sourceforge.net/apidocs/org/joda/time/DateTime.html>instead, as shown in the blog post examples.<http://googleadsdeveloper.blogspot.com/2013/10/adwords-api-how-to-migrate-from-stats.html> The Joda API is much simpler and avoids some of the pitfalls of the standard Date and DateFormat classes. Cheers, Josh, AdWords API Team On Monday, March 10, 2014 8:33:44 PM UTC-4, Tom wrote: > > Hi , > > I am new to adwords. I am trying to use custom date range using JAVA API > and I found on forums that date range is a property of a selector and found > this about stats objects > http://googleadsdeveloper.blogspot.com/2013/10/adwords-api-how-to-migrate-from-stats.html > . > So I am trying: > > Calendar cal = Calendar.getInstance(); > Selector selector = new Selector(); > String startdate = new SimpleDateFormat("20130101").format(cal.getTime()); > String enddate = new SimpleDateFormat("20131231").format(cal.getTime()); > selector.setDateRange(new DateRange(startdate, enddate)); > > but its throwing an error: > > The method > setDateRange(com.google.api.ads.adwords.lib.jaxb.v201309.DateRange) in the > type Selector is not applicable for the arguments > (com.google.api.ads.adwords.axis.v201306.cm.DateRange) > > I am using client library version v201309. > > Please let me know where am I erring. > > Thanks for help ! > -- -- =~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~ Also find us on our blog and Google+: https://googleadsdeveloper.blogspot.com/ https://plus.google.com/+GoogleAdsDevelopers/posts =~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~ You received this message because you are subscribed to the Google Groups "AdWords API Forum" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/adwords-api?hl=en --- You received this message because you are subscribed to the Google Groups "AdWords API Forum" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
